ReportError

Description

Indicates that a server-side error has occurred. This method is for use with JSP 4GL targets only.

Applies to

psPage object

Syntax

psPage.ReportError ( string location, string cause, string message )

Argument

Description

location

The objectName.methodName on which the error is detected

cause

Cause for the processing error

message

The system error message

Returns

None

Usage

The ReportError method simplifies error processing for 4GL Web pages. It causes the ServerError event to be triggered and, depending on the return value of ServerError, adds the error to the error log. Because most events are triggered before generation occurs, the standard way of reporting errors (by doing a psDocument.Write) cannot be used, nor can you centralize error processing using psDocument.Write.

The arguments for the ReportError method are passed to the ServerError event. If the default generation is used, an HTML BR tag is appended to each message, and the message can contain valid HTML to perform formatting. If you display the message in an alert box, do not use HTML tags in the message.

When the server detects an error, it also calls ReportError, passing in the error location as objectName.methodName, the cause of the error, and any applicable system message. If you are assigning the method arguments directly, you should make sure the location argument is meaningful in determining where the error occurred.

NoteOnly call before HTML generation If ReportError is called after the start of generation, the errors are not added to the list; the list is fixed when generation starts. To report errors after generation starts, use psDocument.Write.

Examples

Example 1

This example passes variables for arguments and uses HTML formatting tags:

psPage.ReportError(myLocation, myCause,
"<B><FONT color=green>"+myMessage+"</FONT></B>")

See also