SignalError

Description

Causes a SystemError event at the application level.

Syntax

SignalError ( { number }, { text } )

Argument

Description

number (optional)

The integer (stored in the number property of the Error object) to be used in the message object

text (optional)

The string (stored in the text property of the Error object) to be used in the message object

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. The return value is usually not used.

Usage

During development you can use SignalError to test error-processing scripts.You can call PopulateError to populate the Error object and call SignalError without arguments. You can examine how the SystemError event script handles the forced error. If you pass the optional number and text arguments to SignalError, it populates all the fields in the Error object and then triggers a SystemError event.

In an application, SignalError can also be useful. For example, if a user error is so severe that you do not want the application to continue, you can set values in the Error object, including your own error number, and call SignalError. You need to include code in the SystemError event script to recognize and handle the error you have created.If there is no script for the SystemError event, the SignalError function does nothing.

For the execution-time error numbers assigned to the Number property of the Error object when an application error occurs, see the Users Guide.

Examples

Example 1

These statements set values in the Error object and then trigger a SystemError event so the error processing for these values can be tested:

int error_number

string error_text

Error.Number = 1010

Error.Text = "Salary must be a positive number."

Error.Windowmenu = "w_emp"


error_number = Error.Number

error_text = Error.Text


SignalError(error_number, error_text)

See also