## Error Handling

When an uncaught error occurs during the execution of guiEvent, Simian GUI automatically shows an alert message to the user, and enables the form again. In local MATLAB mode, the error message including stack trace can be found in the 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.

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 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.

### Example

payload.alerts = {struct(...
"type", "danger", ...
"message", "An error occurred in the application back-end.")};

payload["alerts"] = [{
"type": "danger",
"message": "An error occurred in the application back-end."
}]