%CSP.ErrorLog
class %CSP.ErrorLog extends %CSP.Page
This is the default CSP error page. When writing any error pages you should make this your superclass. If an error occurs while running a hyperevent then the response is controled from the HyperEventError(). If it is an error on a standard page then you writing normal HTML output.This error page is designed to log the information to the %ETN system error log and display a simple 'An error has occurred' to the user to avoid leaking any potentially sensitive information. If you would like a more developer friendly error page change the error page to %CSP.Error which will display this same information directly in the page response.
Two particularly interesting errors are the session timeout and the decryption failure errors are both of these can be the result of attempting to go to a page when the users session has timed out or been ended. Commonly you would redirect them to the login page so they can re-enter the application for example in OnPreHTTP method you can write:
Set errorcode=$get(%request.Data("Error:ErrorNumber",1)) If errorcode=$$$ERRORCODE($$$CSPSessionTimeout)||(errorcode=$$$ERRORCODE($$$InvalidDecrypt)) { Set %response.Redirect="/application/login.csp" Quit 1 }
- Error:ErrorCode - The %Status code for this error
- Error:ErrorNumber - The error number assocaited with the ErrorCode
- Error:Namespace - The namespace the page was running in when the error occurred
- Error:URL - The URL of the page in which the error occurred.
- Error:PageName - The name of the page in which the error occurred.
- Error:ResponseContentType - The %response.ContentType at the time of the error.
- Error:ResponseStatus - The %response.Status at the time of the error.
Method Inventory
Parameters
- "" - Return the 404 Page not found error (this is the default)
- Path to a static HTML page - Will display this static page, for example '/csp/samples/static.html' will use the stream server to serve up this static file. This does not require a license, but it will only work with static content.
- "" - Return the 404 Page not found error (this is the default)
- 1 - Will obtain a license and display the standard error page.
- Path to a static HTML page - Will display this static page, for example '/csp/samples/static.html' will use the stream server to serve up this static file. This does not require a license, but it will only work with static content.
- "" - Return the 404 Page not found error (this is the default)
- 1 - Will obtain a license and display the standard error page.
- Path to a static HTML page - Will display this static page, for example '/csp/samples/static.html' will use the stream server to serve up this static file. This does not require a license, but it will only work with static content.
Methods
You could use this javascript to redirect the browser to another page:
Write "CSPPage.window.location='/csp/samples/menu.csp';",!
Write "alert('An error occurred');",!
Inherited Members
Inherited Methods
- %ClassIsLatestVersion()
- %ClassName()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %New()
- %OriginalNamespace()
- %PackageName()
- %SetModified()
- ConvertParameter()
- Decrypt()
- Encrypt()
- EscapeHTML()
- EscapeURL()
- HyperEventCall()
- HyperEventHead()
- Include()
- InsertHiddenField()
- InsertHiddenFields()
- IsPrivate()
- Link()
- OnHTTPHeader()
- OnPageError()
- OnPostHTTP()
- OnPostHyperEvent()
- OnPreHTTP()
- OnPreHyperEvent()
- Page()
- QuoteJS()
- RewriteURL()
- ShowError()
- StartTimer()
- StopTimer()
- ThrowError()
- UnescapeHTML()
- UnescapeURL()