-
Notifications
You must be signed in to change notification settings - Fork 137
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
Improve exception handling #628
Conversation
Works as expected
|
How about putting the issue URL to make it even easier? |
This makes it so that exceptions which don't cause a crash not exit, while exceptions that do cause a crash exit. However, it does print to console twice, which might be weird.
The issue I'm having is some exceptions don't cause a crash, while others do cause a crash, and I can't differentiate them. Should we always crash on uncaught exceptions? |
Which exceptions don't crash? Maybe they are caught somewhere? I wouldn't crash the app more often than we have to. Another idea would be to open a window showing the exception and offering to direct it to Github? (prefill?) |
Now it double prints the exception to the terminal. Should be fine for reading bug reports. |
src/vorta/__main__.py
Outdated
logger.critical("Uncaught exception, file a report at https://github.com/borgbase/vorta/issues/new:", | ||
exc_info=(type, value, tb)) | ||
sys.__excepthook__(type, value, tb) | ||
sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line to make uncaught exceptions never crash, may lead to undesired behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine. Lets crash it all the time. At least we get bug reports quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the exception print a notification. Should I still create a crash?
How about a real UI window in Qt that has the exception and Github link? Else we start with just adding it to the logs. Not sure a notification is useful since it can't be clicked and may be disabled. |
Good solution. Last suggestion: Move the "File a bug report on github.com/..." into the alert, so it can be a real link? Then only the actual exception is logged. |
Because HTML removes line breaks unless there is a Still possible to make the alert a more complex UI element with two separate text widgets. Probably even possible programmatically without doing a .ui file. |
There is a way to automate filling out a bug report with https://github.com/borgbase/vorta/issues/new?title=&body=. We could use that, but it seems like too much work compared to copying and pasting. Edit: Especially for something that most users aren't going to see |
This reverts commit 8379d83.
I expected there to be some URL parameters, like for |
Because we have a message pop up now there is no need to close, unless Vorta is in the background, where we close to prevent it from freezing up and having to be force closed
Codecov Report
@@ Coverage Diff @@
## master #628 +/- ##
==========================================
- Coverage 74.48% 74.27% -0.22%
==========================================
Files 53 53
Lines 3422 3432 +10
==========================================
Hits 2549 2549
- Misses 873 883 +10
Continue to review full report at Codecov.
|
Still exits on uncaught exception, which is same as before.
Should we translate the log message? Just the "Uncaught exception, file a report on GitHub"
Fixes #621
Example, from #619: