Custom error handlers
Last updated
Last updated
Besides customizing the error page, you can also customize how all errors are handled and override the default system behavior.
For example, the default ‘Page Not Found’
error would navigate to the /error
page but if you would rather show a toaster alert, the following could be added to the App
model.
As it can be seen above, custom behaviours are added under a reserved global actions key errorHandlers
, and that will be an array of objects. Each object having have codes
and actions
.
Key | Value |
---|---|
The result from the example code above is the alert shown below.
The error data can be found under options
for each action of the array, for a given code. The error object has the same shape as previously presented here and can be accessed as follows:
Key | Path |
---|---|
codes
array
of error codes that the associated actions will run with.
actions
array of actions
code
actions.options.error.code
description
actions.options.error.description
message
actions.options.error.message