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.
In particular, %request.Get("Error:ErrorCode") contains the error information. Use DecomposeError() to obtain a multidimensional array containing the text of the error or errors, as follows:
Do ..DecomposeError(%request.Get("Error:ErrorCode"),.ErrorInfo)
Then you can loop over the ErrorInfo variable (returned by reference) as follows:
For i=1:1:ErrorInfo {
if (i=1) {
set return="<p>"_ErrorInfo(i,"Desc")_"</p>"
} else {
set return=return_$CHAR(13,10)_"<p>"_ErrorInfo(i,"Desc")_"</p>"
}
}
This example builds a string to be included in the HTML, with one paragraph for each error message.
Also see %CSP.ErrorOpens in a new tab for additional 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.