-
-
Save wolph/88e3222ac57d9c3bff113ff83afddda4 to your computer and use it in GitHub Desktop.
Best exception handling in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import webbrowser | |
def main(): | |
return 42/0 | |
def excepthook(type_, value, traceback): | |
webbrowser.open_new_tab('https://stackoverflow.com/search?q=[python] {} {}'.format(type_, value)) | |
sys.__excepthook__(type_, value, traceback) | |
sys.excepthook = excepthook | |
if __name__== '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment