Handling Errors
For any web application, InterSystems IRIS® provides a default error page that displays a message to the user if an application error occurs. You can instead provide your own custom error page. There are special options in the case when an error occurs and no license has been obtained (so server code cannot be run).
Adding a Custom Error Page
To add a custom error page:
-
Create a subclass of %CSP.ErrorOpens in a new tab and customize its OnPage() callback method.
In this class, you can use the %request, %response, and %session objects as usual.
%CSP.ErrorOpens in a new tab provides methods for pulling information out of the error.
-
Optionally override parameters of this class to display custom pages when no license has been granted.
-
Configure the web application to use this error class.
Handling Errors Before License Grant
If a web application does not yet have a license, and a error occurs, then InterSystems IRIS displays the standard web HTTP/1.1 404 Page Not Found error message by default.
You can change what page is displayed when errors are encountered in such cases by specifying the following parameters in your error page class:
This parameter controls what InterSystems IRIS does when a license cannot be granted. The parameter can have either the following two values:
-
"" or null — Returns the HTTP/1.1 404 Page Not Found error (default)
-
Path to a static HTML file — Displays the named file, such as /csp/myapp/static.html.
This parameter controls what InterSystems IRIS does if any of the following errors are generated:
-
License cannot be granted
-
Class does not exist
-
Method does not exist
-
Web application does not exist (set parameter on default error page)
-
CSP page does not exist
-
File does not exist
-
Namespace does not exist
-
Illegal request
-
File cannot be opened
-
Session timeout
The parameter can have either the following values:
-
"" — Return the HTTP/1.1 404 Page not found error (default)
-
1 — Obtains a license and displays the standard error page.
-
Path to a static HTML file — Displays the named file, such as /csp/myapp/static.html.
This parameter controls what InterSystems IRIS does in the case of other errors. The parameter can have any the following values:
-
"" — Obtains a license and displays the standard error page (the default)
-
1 — Outputs the 404 Page not found error.
-
Path to a static HTML file — Displays the named file, such as /csp/myapp/static.html.