Introduce a general error handler#129
Merged
1over137 merged 2 commits intoFreeLanguageTools:masterfrom Jan 28, 2024
Merged
Conversation
Contributor
|
Looks good, but we should probably use the logger rather than printing so it can be seen more easily by people using it without a console. I notice that a lot of exceptions are getting caught at earlier levels, maybe some of that should be removed (especially by the QTimers it seems) |
Uncaught exceptions will be caught by this handler, and it will present a dialog with a stack trace, but also still print the error to the console. Also, make issues fetching forvo clips throw exceptions, which is a great way to test it
2dfbfde to
a31a7bf
Compare
Contributor
Author
I still think that catching exceptions other places is ideal. In many cases I think the following pattern'd be good: try:
get_forvo_audio():
except NetworkException:
logger.exception("Error fetching audio")
QMessageBox.Critical("Error fetching audio", "Could not connect to forvo.com. Please check that your network connection is up, and forvo.com is reachable")Giving the error messages locally allows us to do something that's a bit more userfriendly, than long stacktraces. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uncaught exceptions will be caught by this handler, and it will present
a dialog with a stack trace, but also still print the error to the console.
Also, make issues fetching forvo clips throw exceptions, which is a
great way to test it.
Being able to see when something goes wrong is really a great usability improvement imho