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

Need catch-all handler for early exceptions #75

Closed
csatt opened this issue Oct 13, 2019 · 1 comment
Closed

Need catch-all handler for early exceptions #75

csatt opened this issue Oct 13, 2019 · 1 comment
Assignees

Comments

@csatt
Copy link
Owner

csatt commented Oct 13, 2019

Exceptions that are detected once mainloop() is running are logged and generate a dialog asking the user to send the log file. But (otherwise uncaught) exceptions that occur before mainloop() is running are not logged and are impossible to debug when the app is run with the standard pyinstaller executables. This was the case when a user encountered the problem reported in Issue #66. Fortunately, he was willing to run a special debug version of the app that started from the console, which allowed the stack trace to be seen.

What is needed is a catch-all exception handler that logs the stack trace and generates a dialog for otherwise uncaught exceptions that occur before mainloop() is running.

@csatt
Copy link
Owner Author

csatt commented Oct 13, 2019

Since the exception could be detected even before logging is set up (and is by definition before the GUI is running), the stack trace cannot be "logged" and a dialog cannot be displayed. Instead, the stack trace should be written to a temporary file and the file should be opened with the system viewer.

csatt added a commit that referenced this issue Oct 13, 2019
A try/except is now added in main() around the creation of the GraphicalUserInterface object and the call to its run() method. A new handle_early_exception() global function is called in the "except" branch. This function creates a temporary file and writes the error message and stack trace to that file. It then opens that file using the system viewer.
@csatt csatt closed this as completed Oct 13, 2019
@csatt csatt self-assigned this Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant