SystemError

Description

Occurs when a serious runtime error occurs (such as trying to open a nonexistent window) if the error is not handled in a try-catch block.

Event ID

Event ID

Objects

None

Application

Arguments

None

Returns

None. (Do not use a RETURN statement.)

Usage

If there is no script for the SystemError event, PowerBuilder displays a message box with the PowerBuilder error number and error message text. For information about error messages, see the PowerBuilder Users Guide.

If you comment out the entire script in the SystemError event, a Windows Forms application behaves as if there is no script for the event and the message box displays, but in a standard PowerBuilder application the event is still triggered and the message box does not display.

For errors involving external objects and DataWindows, you can handle the error in the ExternalException or Error events and prevent the SystemError event from occurring. The ExternalException and Error events are maintained for backward compatibility.

You can prevent the SystemError event from occurring by handling errors in try-catch blocks. Well-designed exception-handling code gives application users a better chance to recover from error conditions and run the application without interruption. For information about exception handling, see Application Techniques.

When a SystemError event occurs, your current script terminates and your system might become unstable. It is generally not a good idea to continue running the application, but you can use the SystemError event script to clean up and disconnect from the DBMS before closing the application.

Examples

Example 1

This statement in the SystemError event halts the application immediately:

HALT CLOSE

See also