IRISLIB database
ErrorLog Class Reference

This is the default CSP error page. More...

Inheritance diagram for ErrorLog:
Collaboration diagram for ErrorLog:

Static Public Member Functions

_.Library.String ClassifyError (err)
 Classify if this is an expected error like a page not found and if so return the response.Status information. More...
 
_.Library.Status DecomposeError (_.Library.Status sc, _.Library.String ErrorInfo)
 Return an array of information in ErrorInfo about the error suitable for display with a. More...
 
 HyperEventError ()
 If an error occurs while processing a HyperEvent then this method is called. More...
 
 LogError ()
 Dump all information to local arrays and call ETN to log this error.
 
_.Library.Boolean OnErrorSetup (_.Library.Boolean skipheader)
 This is called before the OnPreHTTP and will handle the HyperEvent errors and. More...
 
_.Library.Status OnPage ()
 Output the error page as HTML. More...
 
- Static Public Member Functions inherited from Page
_.Library.Status ConvertParameter (_.Library.String url, _.Library.String name, _.Library.String value)
 You pass this the <parameter>url</parameter> of the page you are going to and a. More...
 
_.Library.Binary Decrypt (_.Library.String data)
 Decrypts the input string using the session.Key value that is unique to. More...
 
_.Library.String Encrypt (_.Library.Binary data)
 Encrypts the input string using the session.Key value that is unique to this. More...
 
_.Library.String EscapeHTML (in)
 This method converts input HTML text into Escaped HTML text.
 
_.Library.String EscapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in input URL string into Escaped URL string. More...
 
_.Library.String HyperEventCall (_.Library.String methodName, _.Library.String args, _.Library.Integer type, _.Library.Boolean mobile)
 This method returns the string that needs to be written to the current. More...
 
_.Library.String HyperEventHead (_.Library.Boolean iframeOnly, _.Library.Boolean strict, _.Library.Boolean optionalBroker)
 This method returns the string that needs to be written to the current. More...
 
 Include (_.Library.String url)
 Include another csp page or file in the output at this point. More...
 
_.Library.String InsertHiddenField (_.Library.String url, _.Library.String name, _.Library.String value, _.Library.String extra)
 Inserts a '<input type="hidden" name="Name" value="Value">' tag into the current document. More...
 
_.Library.String InsertHiddenFields (_.Library.String url, _.Library.String query)
 Return the string containing the hidden form tags. More...
 
_.Library.Boolean IsPrivate ()
 Returns 1 if this page is in fact a private page (see <parameter>PRIVATE</parameter>).
 
_.Library.String Link (_.Library.String link, _.Library.String query, _.Library.Boolean addQ)
 Tranforms the link specified by link into a URL and returns it as a string. More...
 
_.Library.Status OnHTTPHeader (_.Library.Boolean OutputBody)
 Event handler for PAGE event: this is invoked in order to
More...
 
 OnPageError (_.Library.Status sc)
 Event handler for any error that occurs on the page. More...
 
 OnPostHTTP ()
 Event handler for POSTPAGE event: this is invoked after the data. More...
 
_.Library.Status OnPostHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked after a hyperevent method is called on this page.
 
_.Library.Boolean OnPreHTTP ()
 Event handler for PreHTTP event: this is invoked before. More...
 
_.Library.Status OnPreHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked before a hyperevent method is called on this page. More...
 
_.Library.Status Page (_.Library.Boolean skipheader)
 Process a request to serve a CSPPage. More...
 
_.Library.String QuoteJS (in)
 This method converts input string into quoted JavaScript literal.
 
_.Library.String RewriteURL (_.Library.String url)
 This method will rewrite a URL to use #url()# if needed.
 
 ShowError (_.Library.Status sc)
 Display a <class>Status</class> error code to the CSP Page.
 
 StartTimer (_.Library.String name)
 Used to get performance information on your CSP pages. More...
 
 StopTimer (_.Library.String name)
 Used to time performance information on your CSP pages. More...
 
 ThrowError (_.Library.Status sc)
 Passed a <class>Status</class> code this goes to the error page passing this status code.
 
_.Library.String UnescapeHTML (in)
 This method converts Escaped HTML text into normal HTML text.
 
_.Library.String UnescapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in Escaped URL string back to its original form. More...
 

Static Public Attributes

 LICENSEERRORPAGE = None
 This is the default CSP error page. More...
 
 OTHERSTATICERRORPAGE = None
 If the user with a new session goes to a page that causes an error before a license is obtained then in order to. More...
 
 PAGENOTFOUNDERRORPAGE = None
 If the user with a new session goes to a page that is not present then in order to display the standard error page. More...
 
 PRIVATE = None
 Error pages should be private to avoid the chance the user can go to them. More...
 
- Static Public Attributes inherited from Page
 CHARSET = None
 The <CLASS>CSP.Page</CLASS> object serves as an event handler for CSP requests. More...
 
 CONTENTTYPE = None
 Specifies the default content type for the page. More...
 
 CONVERTINPUTSTREAM = None
 Specifies if input request.Content or request.MimeData values are converted from their. More...
 
 CSPFILE = None
 If this page was compiled from a .csp file, then this parameter contains the. More...
 
 CSPSTRICT = None
 The CSPSTRICT parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 CSPURL = None
 This parameter is used to make sure that if multiple. More...
 
 CSPXHTML = None
 The CSPXHTML parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 DOMAIN = None
 The default domain for csp:text, span and div tags. More...
 
 ENCODED = None
 Controls how the query parameters for this page are passed, it can. More...
 
 ERRORPAGE = None
 Specify a custom error page to call if there are any problems with generating this page. More...
 
 EXPIRES = None
 Specified the default value for the response.Expires. More...
 
 NOCHARSETCONVERT = None
 Specifies if we wish to turn off charset conversion for this page. More...
 
 PAGETIMING = None
 If this parameter is true then we automatically record timing statistics of how long it takes to. More...
 
 PRIVATE = None
 Controls the access to the page, it can be set to one of the following:
More...
 
 SECURITYRESOURCE = None
 This is a comma-delimited list of system Resources and associated. More...
 
 TIMINGSLOTS = None
 Used by the timing to decide how many slots a day should be divided up into. More...
 
 UseSession = None
 This parameter controls the CSP session support. More...
 

Detailed Description

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 <METHOD>HyperEventError</METHOD>. 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 <class>CSP.Error</class> 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 }

When an error occurs several variables are set in the request object because these may be overwritten in generating the error page itself. These variables are all prefixed by 'Error:' and the list is:

  • Error:ErrorCode - The <class>Status</class> 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.

The error page will automatically set the response.Status for some of the standard errors, such as not being able to find the CSP page . If you wish to override this setting do so in the OnPreHTTP method.

Member Function Documentation

◆ ClassifyError()

_.Library.String ClassifyError (   err)
static

Classify if this is an expected error like a page not found and if so return the response.Status information.

If the error is not an expected error it will return "".

◆ DecomposeError()

_.Library.Status DecomposeError ( _.Library.Status  sc,
_.Library.String  ErrorInfo 
)
static

Return an array of information in ErrorInfo about the error suitable for display with a.

bit of formatting. You pass in the sc which is the status code of the error. It assumes you are dealing with CSP related errors.

◆ HyperEventError()

HyperEventError ( )
static

If an error occurs while processing a HyperEvent then this method is called.

This method will write out javascript code that will be executed on the browser. Note that the variable 'CSPPage' refers to the 'self' of the page on which the Hyperevent was called as this may be different to the current 'self'.

You could use this javascript to redirect the browser to another page:

Write "CSPPage.window.location='/csp/samples/menu.csp';",!

Or you could popup an alert box with the error message in it:

Write "alert('An error occurred');",!

Reimplemented in LogError, and Error.

◆ OnErrorSetup()

_.Library.Boolean OnErrorSetup ( _.Library.Boolean  skipheader)
static

This is called before the OnPreHTTP and will handle the HyperEvent errors and.

setup the status line in the response for the standard errors.

◆ OnPage()

_.Library.Status OnPage ( )
static

Output the error page as HTML.

This makes use of the ##class(CSP.Utils).DisplayAllObjects()

call to display as much information as possible about the state of the request, response, server objects when the error occurred.

Reimplemented from Page.

Reimplemented in StudioTemplateError, LogError, and Error.

Member Data Documentation

◆ LICENSEERRORPAGE

LICENSEERRORPAGE = None
static

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 <METHOD>HyperEventError</METHOD>. 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 <class>CSP.Error</class> 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 }

When an error occurs several variables are set in the request object because these may be overwritten in generating the error page itself. These variables are all prefixed by 'Error:' and the list is:

  • Error:ErrorCode - The <class>Status</class> 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.

The error page will automatically set the response.Status for some of the standard errors, such as not being able to find the CSP page . If you wish to override this setting do so in the OnPreHTTP method.

If the user with a new session goes to a page and CSP is unable to allocate a license we can not run the normal

error page as this requires a license. The default behavior is to report a 'HTTP/1.1 404 Page not found' HTTP response as this does not require a license. You may change this by setting the class parameter LICENSEERRORPAGE on the error page for this CSP application (or the default error page in the case of the application not found error). The values are:

  • "" - 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.

◆ OTHERSTATICERRORPAGE

OTHERSTATICERRORPAGE = None
static

If the user with a new session goes to a page that causes an error before a license is obtained then in order to.

display the standard error page to report this error CSP would take out a license. To avoid this license use in this case the default behavior is to report a 'HTTP/1.1 404 Page not found' HTTP response. This does not require a license. You may change this by setting the class parameter OTHERSTATICERRORPAGE on the error page for this CSP application (or the default error page in the case of the application not found error). The values are:

  • "" - 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.

◆ PAGENOTFOUNDERRORPAGE

PAGENOTFOUNDERRORPAGE = None
static

If the user with a new session goes to a page that is not present then in order to display the standard error page.

to report this error CSP would take out a license. To avoid this license use if the error is because the application is not found, or the page is not found, or the class does not exist, or the page is private and the token is not correct then the default behavior is to report a 'HTTP/1.1 404 Page not found' HTTP response. This does not require a license and it is standard behavior if you goto a page that is not present on a normal web server. You may change this by setting the class parameter PAGENOTFOUNDERRORPAGE on the error page for this CSP application (or the default error page in the case of the application not found error). The values are:

  • "" - 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.

◆ PRIVATE

PRIVATE = None
static

Error pages should be private to avoid the chance the user can go to them.

directly by just typing in the address.