Error handling utilities. Including this module will automatically handle 'error' and 'unhandledrejection' events if not caught.
Classes
Methods
(static) setFatalErrorText(preamble, postamble)
Set fatal error confirmation messages. When a fatal error occurs, the user is given the choice to either reload the page, the OK option on the standard confirm dialog, or go back to the previous page by selecting CANCEL. The confirm dialog shows the preamble, followed by an error message, a blank line and then finally the postamble.
The defaults are shown below:
- preamble: 'Whoops! A serious error has occurred:'
- postamble: 'Do you want to reload the page? If you cancel, we'll try to go back to the previous page.'
This method allows you to change these strings to allow localisation.
Parameters:
| Name | Type | Description |
|---|---|---|
preamble |
string | The new preamble. Blank or undefined text will be ignored and not change the current value. |
postamble |
string | The new postamble. Blank or undefined text will be ignored and not change the current value. |
(static) showAndHandleFatalError(message)
Show a fatal error. NB we don't use translation in case the error occurred in translation. There is no return as the function either reloads or goes back in the history.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string | Message to include |