Error handler
Last updated
Last updated
The error handler captures errors thrown by a function, allowing you to use the error message in an app. A common use case is to visualize the error, such as displaying it in a toast bar widget, to inform users about a problem.
It falls under the category of function extensions. Adding and deleting error handlers follows the same process as with the other extensions. Click the +
icon behind an output, and select Error Handler
. The error handler is specific to the function it is used in, and having more than one error handler for a single function is not useful.
Errors are captured as objects, indicated by the curved brackets. You can now work with the thrown error just like with any other output. For example, you can use JSONata to modify it and extract the actual value using the message
key in the modifier, as shown in the image below.
As you can see in the image, the error handler is positioned on the same level as the function output, as it basically is an alternative type of function output.
In the App Builder, you can identify a function that is throwing an error by the red status indicator. Hovering above it reveals additional details about the error.