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 of the |
|
DLLName |
String |
(PBXRuntimeError only) Name of the PowerBuilder |
|
HelpFile |
String |
(OLERuntimeError only) Full file name of Help file |
|
HelpContext |
UnsignedLong |
(OLERuntimeError only) Help context ID of the topic |
|
Line |
Integer |
Line number where the exception |
|
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 exception |
|
Source |
String |
(OLERuntimeError only) Source of the |
|
Text |
String |
Text associated with the type of |
Events
|
RuntimeError event |
Occurs |
|---|---|
|
When the exception is thrown |
|
|
Immediately after the exception is |
Functions
|
RuntimeError function |
Datatype returned |
Description |
|---|---|---|
|
String |
Returns the name assigned to the |
|
|
Integer |
Creates a reference to a context-specific instance |
|
|
String |
Returns the error message from objects of type |
|
|
PowerObject |
Returns a reference to the name of the parent |
|
|
Boolean |
Adds an event to the end of the message queue for |
|
|
|
Sets an error message for an object of type |
|
|
Integer |
Triggers a specific event in the object and |
|
|
Object |
Returns the type of the object |