Currently errors in the PCP are handled in the gpii.app.handleUncaughtException function. What this function does is to display a standard OS notification via the Tray object. However, there are a few limitations to using Tray notifications:
- Listeners for closing or clicking of a notification are registered on the Tray object itself, not on a particular notification. Furthermore, the events that are passed as arguments whenever these listeners are invoked do not provide information about the notification with which it has been interacted.
- It seems that the Tray API does not provide a way to control how long the notification is displayed.
- If multiple notifications need to be shown, they are queued and all of them are shown sequentially.
In order to avoid the first limitation of Tray balloon notifications, one of the following alternatives can be used:
- Electron main process notifications which require using a newer version of electron than the current one (1.4.1). Migration to the latest version of electron appeared to be not as straightforward as executing npm install email@example.com as the application could not be started.
- HTML5 Notification API which will require IPC between the main and the renderer process.
Another major thing that needs to be considered if OS notifications will continue to be used for displaying application errors is whether (and to what extent) the accessibility of such notifications can be controlled.
The goal of this task is to change the error displaying functionality of the PSP application so that it is more flexible and reliable. Having in mind all the background information about Tray and native OS notifications, it is important to first decide whether they can continue to be used, or if a totally different approach is needed (e.g. displaying the errors in a separate BrowserWindow).