Error object

The Error object is used to record execution-time errors. You can access the Error object from a script (typically in the SystemError event) to learn which error occurred and where it occurred. You can also customize your own version of the Error object by defining a class user object inherited from the built-in Error object.

For more information about creating a custom Error object, see Working with User Objects in Users Guide. For information on using try-catch blocks to catch runtime and user-defined exceptions, see the section called “Exception handling in PowerBuilder” in Application Techniques and the the section called “TRY...CATCH...FINALLY...END TRY” in PowerScript Reference.

Properties

Error property

Datatype

Description

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

Line

Integer

Identifies the line in the script at which the error occurred.

Number

Integer

Identifies the PowerBuilder error.

Object

String

Contains the name of the object in which the error occurred. If the error occurred in a window or menu, Object will be the same as WindowMenu.

ObjectEvent

String

Contains the event in which the error occurred.

Text

String

Contains the text of the error message.

WindowMenu

String

Contains the name of the window or menu in which the error occurred.


Events

Error event

Occurs

Constructor

When the user object is created.

Destructor

When the user object is destroyed.


Functions

Error function

Datatype returned

Description

ClassName

String

Returns the name assigned to the user object.

GetContextService

Integer

Creates a reference to a context-specific instance of the specified service.

GetParent

PowerObject

Returns a reference to the name of the parent object.

PostEvent

Boolean

Adds an event to the end of the message queue of the user object.

TriggerEvent

Integer

Sends an event to the user object and executes the script associated with the event.

TypeOf

Object

Returns the type of the user object.