The root of the inheritance hierarchy for almost all ARM interfaces.
It provides a common way to handle errors. If a method invocation on any
ARM object causes an error, the error code returned by the object's
getErrorCode()
will be negative. If no error occurs, the error
code is zero. Several methods also return the error code as an
int
return value. If an error occurs in a factory method
(e.g., a method in
ArmTransactionFactory
), the error code
is set in both the factory object and the newly created object. The
implementation of the object has sole discretion as to whether a method
results in an error.
The error code may change any time a method of the object is executed.
Executing a method overrides the previous error code value. The only
methods that will never change the error code are
getErrorCode()
and
getErrorMessage()
.
If multiple threads are processing the same object simultaneously, the
results are unpredictable. An error code set as a result of an operation
in method X could be replaced by an operation in method Y before
thread X executes
getErrorCode()
.
The error code can also be set with
setErrorCode(int)
. This is a way
for the application to reset or change the error code. It would most
typically be used in a callback registered with the ARM implementation's
factory objects used to create ARM objects on behalf of the application.
In this way the application can implement a central error handling
policy in the callback. A value set with
setErrorCode()
in a callback overwrites the previous value (i.e., the value that caused
the callback to be made).
For any non-zero error code returned by an object, the application can
request from the same object a string message describing the error
using
getErrorMessage(int)
. If the object does not support the
function or does not recognize the error code, it returns
null
.