-
-
Notifications
You must be signed in to change notification settings - Fork 8
Description
What is the problem or limitation you are having?
If a GUI app published as a system package fails, the stack trace is output to the console. However, if the app has been started from an icon, there will be no console visible, so the app will crash silently.
An easy way to manifest this - add import numpy to your app, without adding numpy to your requirements.
Describe the solution you'd like
On macOS and Windows, the stub binary contains a handler that catches exceptions from the running app, and manifests a system dialog to display the stack trace. In the numpy example, you see an ModuleNotFoundError stack trace, allowing you to diagnose the problem.
Linux system app should have a similar handler.
This is complicated slightly by the fact that we can't guarantee what GUI libraries are present.
We should modify the stub application so that it will generate a GTK stack trace dialogs if GTK is available. The system_requires or system_runtime_requires options in Briefcase could be interrogated to see which library is available.
This mechanism should be sufficiently flexible that other stack trace dialogs could be added (eg., a Qt dialog if Qt is available).
Describe alternatives you've considered
If there is some other mechanism from free desktop et al to "display a stack trace dialog", we could use that instead; however, I'm not aware of any system-level API to do this.
If there is a lower-level API that could be used to display a dialog (e.g., raw X APIs that we can guarantee exist on all GUI apps?), we could use that instead.
Additional context
We will still need to handle the case of console apps, where outputting to console is appropriate. This case is handled on macOS and Windows at time of template generation.
Falling back to the status quo (console output) if a supported GUI toolkit can't be found is also an option.
See beeware/briefcase-linux-flatpak-template#60 for an analogous problem with Flatpak packaging.