Error Handling
When an uncaught error occurs during the execution of gui_event
, Simian GUI automatically shows an alert message to the user. The user gets the option to reload or close the app.
In local mode, the error message including stack trace can be found in the console / command window.
It is recommended to prevent errors from happening as much as possible. When there are situations where errors may occur, it is recommended to catch the error and handle it appropriately.
Alerts
To indicate success or failure of a calculation, dismissable alerts can be displayed above the form.
The alerts can be defined by specifying payload.alerts
.
The value must be a list of dictionaries (Python) or a cell array of structs (MATLAB) with fields type
and message
, where type can be danger
, warning
, success
, info
, primary
, secondary
, dark
or light
. The utils.addAlert
function can be used to add alerts to the payload.
Example
payload = utils.addAlert(
payload,
"An error occurred in the application back-end.",
"danger",
)
payload = utils.addAlert(...
payload, ...
"An error occurred in the application back-end.", ...
"danger");