Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%SYSTEM] >  [Error]
Private  Storage   

class %SYSTEM.Error extends %RegisteredObject

%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, an ObjectScript 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.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
6 10


Summary

Properties
Code Message SQLCode Severity Status
messageId

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OnNew %OriginalNamespace
%PackageName %RemoveFromSaveSet %SerializeObject %SetModified
%ValidateObject AsException FromException FromSQLCode
FromXSQL SQLCodeGet SQLCodeSet findXRef
getOdbcError


Properties

• property Code as %String(MAXLEN=255) [ InitialExpression = "0" ];
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 Message as %String(MAXLEN="");
Additional free text information about the error, may be null
• property SQLCode as %String(MAXLEN="");
SQLCode of this error, may be null.
• 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. InterSystems IRIS will exit the current procedure if severity is > 19.
• property Status as %Status;
The %Status code of this error. An error will ALWAYS have a %Status value
• property messageId as %Integer;
This is computed from the value of Status

Methods

• method %OnNew(pStatus As %Status = "", pSQLCode As %String = "", pMessage As %String = "", pSeverity As %Integer = 0) as %Status
Create a new error given a %Status or an SQLCODE and %message value. Severity applies to certain XSQL systems (TSQL only for now)
• method AsException() as %Exception.AbstractException
asException() - return a new instance of an exception
• classmethod FromException(pException As %Exception.AbstractException = "") as %SYSTEM.Error
fromException() - instantiate a new %SYSTEM.Error object from an exception object.
• classmethod FromSQLCode(pSQLCODE As %Integer = -400, pMessage As %String(MAXLEN="")="") as %SYSTEM.Error
fromSQLCode() - instantiate a new %SYSTEM.Error object from an SQLCODE and message.
• classmethod FromXSQL(pDomain As %String = "", pXSQLCODE As %Integer = 0, pMessage As %String(MAXLEN="")="") as %SYSTEM.Error
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)
• method SQLCodeGet() as %String
This is a Get accessor method for the SQLCode property.
• method SQLCodeSet(newvalue As %String) as %Status
This is a Set accessor method for the SQLCode property.
• method findXRef(messageDomain As %String) as %Integer
findXRef - lookup a cross-referenced message in the requested domain
• method getOdbcError(sqlcode, message)


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.