Error Handling

When an uncaught error occurs during the execution of guiEvent, Simian GUI automatically shows an alert message to the user. The user gets the option to reload or close the app. In local MATLAB mode, the error message including stack trace can be found in the command window.

Error dialog

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.

Alert message

The alerts can be defined by specifying payload.alerts. The value must be a cell array of structs (MATLAB) or a list of dictionaries (Python) 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",
)