Skip to main content

%Exception.AbstractException

Class %Exception.AbstractException Extends %Exception.CPPException [ Abstract ]

The %Exception.AbstractException defines the interface to exceptions that may be caught and thrown via the Try/Catch exception handling facilities. Users wishing to define new exception classes should inherit from this interface class. Only instances of classes that inherit from %Exception.AbstractException may be thrown with the 'throw' command.

Methods

%OnNew

Method %OnNew(pName As %String = "", pCode As %String = "", pLocation As %String = "", pData As %String = "", pInnerException As %Exception.AbstractException = {$$$NULLOREF}) As %Status [ Private ]

OutputToDevice

Method OutputToDevice(pLevel As %Integer = 0) [ ServerOnly = 1 ]

This outputs the string representation of the exception to the current device, recursively outputing any inner exceptions.

OutputToStream

Method OutputToStream(pStream As %CharacterStream, pLevel As %Integer = 0)

This outputs the string representation of the exception to the supplied stream, recursively outputting any inner exceptions.

DisplayString

Method DisplayString(pLevel As %Integer = 0) As %String

This returns a string that represents the exception. Users should feel free to modify the format in subclasses.

BinDisplayString

Method BinDisplayString(pLevel As %Integer = 0) As %Binary [ Internal ]

SQLMessageString

Method SQLMessageString(pLevel As %Integer = 0) [ Deprecated ]

This returns a string that represents the SQL %msg string. Users should feel free to modify the format and content in subclasses.
DEPRECATED - use AsSQLMessage() instead. Override OnAsSQLMessage() to customize the value returned by AsSQLMessage().

AsStatus

Method AsStatus() As %Status [ Final ]

Convert this exception to a %Status compatible value.

OnAsStatus

Method OnAsStatus() As %Status [ CodeMode = expression, Private ]

Override this method to provide a custom conversion of an exception to a status.

AsSQLCODE

Method AsSQLCODE() As %Integer [ Final ]

Return the SQLCODE value corresponding to the exception.

OnAsSQLCODE

Method OnAsSQLCODE() As %Integer [ CodeMode = expression, Private ]

Override this method to provide a custom conversion of an exception to an SQLCODE value.

AsSQLMessage

Method AsSQLMessage() As %String(MAXLEN="") [ Final ]

Return the SQL %msg string describing details of the exception.

OnAsSQLMessage

Method OnAsSQLMessage() As %String(MAXLEN="") [ CodeMode = expression, Private ]

Override this method to provide a custom conversion of an exception to the SQL %msg string.

Log

Method Log() As %Status

Call the log function (LOG^%ETN) to log this exception. You can view this log at the terminal with 'Do ^%ER' utility or from the system management portal.

StackAsArray

Method StackAsArray(ByRef array) As %Status

This method sets an array that is passed by reference to the execution stack at the time of the exception. The top unsubscripted value is the number of execution levels.

array(n) is a string that indicates how the next level was created. It is empty for the current level. The value may be:
DO - issued a DO command
$$ - called an extrinsic function
XECUTE - issued an XECUTE command
BREAK - entered a debug prompt because of a
ERROR - entered a debug prompt because of an error
$ETRAP - executed a $ETRAP
CALLIN - entered via a callin

array(n,"PLACE") is the location of the last command executed at this level. It is a line reference followed by the command number on that line.