For information on converting to InterSystems IRIS,
see the InterSystems IRIS Adoption Guide
and the InterSystems IRIS In-Place Conversion Guide,
both available on the WRC Distributions page (login required).
%SYSTEM.Error is a generic error container used to return error information reported
from various sources. Errors can occur in several different ways. A %Status value can
be returned, a Cache error can be trapped and reported as $ZERROR, an SQLCODE error
can be reported by an SQL statement, or an error number from an XSQL procedure can
be reported. All of these errors must be recognizable and be able to be reported in
various forms. xDBC expects an SQLCODE while other systems might want %Status values.
This class provides a mechanism for consistent reporting and detection.
The error code - for CacheError (messageId = 5002) this is the $ZError code ($e($ze,1,$f($ze,1,">"))
for SQLError (messageId = 5540) this is the SQLCODE value. For most other messageId's, this is 0 (zero).
Code simply provides additional detail for a %Status error
property Severity as %Integer (MAXVAL = 25, MINVAL = 0);
Severity is an indication as to the severity of the error being reported. The value, 0-25, not
only provides information, it is a hint to the error processor as to what action to take. For
TSQL this means returning control to the current batch or procedure at the point following the statement
reporting the error, exiting the current batch or procedure or terminating the connection.
TSQL defines severity of 10-19 as transferring to the CATCH block. Cache will exit the current
procedure if severity is > 19.
FromXSQL() - instantiate a new %SYSTEM.Error object from an error code that originates from and XSQL procedure.
This is called from generated code for TSQL RAISERROR (v27) and Informix RAISE EXCEPTION (v25)