Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom exceptions instead of sys.exit in Hiscores #11

Merged

Conversation

Haran
Copy link

@Haran Haran commented Mar 14, 2021

Issue

  1. Due to sys.exit() calls in Hiscores.py it is not possible to work with library in applications like Discord bots. One can use except SystemExit, but in this case error message will be left out of control flow (e.g. logging).

Proposition

If sys.exit() is replaced by custom exception it is possible to try-except invocation of Hiscores() and gracefully process errors

Impact on current implementation

  1. Program still will terminate, but with stacktrace and verbose information about cause of the error
  2. According to POSIX, exit code 0 means that program has been executed successfully and didn't return any errors. Taking that fact into account, uncaught exception is even more preferable because it will result exit code 1, which indicates error in runtime.

@Haran Haran changed the title sys.exit replaced by custom exceptions Custom exceptions instead of sys.exit in Hiscores Mar 14, 2021
@Coffee-fueled-deadlines Coffee-fueled-deadlines merged commit cb0f778 into Coffee-fueled-deadlines:master Mar 15, 2021
@Haran Haran deleted the noexit branch March 21, 2021 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants