RuntimeError object
The RuntimeError object inherits from the Throwable
object and is used by the PowerBuilder virtual machine (PBVM) to
throw runtime errors. Runtime errors are also called unchecked exceptions.
You do not need to declare where they might be thrown and you do
not need to catch them as you do checked exceptions.
When a RuntimeError is thrown, its properties are populated
automatically with the runtime information associated with the line
where the error occurred. If a RuntimeError is not handled, the
Application object SystemError event is triggered and the global
Error object is populated with the runtime information.
The following derived types provide more robust error-handling
capabilities:
-
DivideByZeroError – thrown when an
attempt is made to divide by zero. -
NullObjectError – thrown when an attempt
is made to access an object using a null reference. -
PBXRuntimeError – thrown when an unknown
error occurs in a PowerBuilder extension. -
CORBASystemException – thrown when a CORBA system
exception is thrown from EAServer. -
DWRuntimeError – thrown when a DataWindow
error occurs that is not handled by an Error event script. -
OLERuntimeError – thrown when an OLE
error occurs that is not handled by an ocx_error, ExternalException,
or Error event script
Additional objects that map to standard CORBA exception types
inherit from CORBASystemException. The PowerBuilder exception class
name is the same as the CORBA exception name without underscore
characters. For example, CORBAFreeMem maps to CORBA_FREE_MEM.
You can view the list of CORBASystemException types in the PowerBuilder
System Tree or in the Browser.
The descendants of RuntimeError allow you to handle specific
runtime errors. For example, you can catch only NullObjectError
exceptions in a specific block of code. Alternatively, you can catch
all runtime errors with a single CATCH statement. Except for PBXRuntimeError,
the error information available in the descendant objects is also
available in the RuntimeError object.
PBXRuntimeError has an additional property, DLLName, that
identifies the name of the PowerBuilder extension DLL in which the
error occurred.
Properties
RuntimeError property |
Datatype |
Description |
---|---|---|
ClassDefinition |
PowerObject |
An object of type PowerObject containing |
Class |
String |
Name of the class where the exception |
Description |
String |
(OLERuntimeError only) Textual description |
DLLName |
String |
(PBXRuntimeError only) Name of the PowerBuilder |
HelpFile |
String |
(OLERuntimeError only) Full file name |
HelpContext |
UnsignedLong |
(OLERuntimeError only) Help context ID |
Line |
Integer |
Line number where the exception occurred |
Number |
Integer |
Number of the PowerBuilder error |
ObjectName |
String |
Name of the object where the exception |
RoutineName |
String |
Name of the event or routine where the |
Source |
String |
(OLERuntimeError only) Source of the |
Text |
String |
Text associated with the type of exception |
Events
RuntimeError event |
Occurs |
---|---|
When the exception is thrown |
|
Immediately after the exception is thrown |
Functions
RuntimeError function |
Datatype returned |
Description |
---|---|---|
String |
Returns the name assigned to the object |
|
Integer |
Creates a reference to a context-specific |
|
String |
Returns the error message from objects |
|
PowerObject |
Returns a reference to the name of the |
|
Boolean |
Adds an event to the end of the message |
|
— |
Sets an error message for an object of |
|
Integer |
Triggers a specific event in the object |
|
Object |
Returns the type of the object |