ISystemErrorInfo

The ISystemErrorInfo class represents error information that you can include in an exception object. When an operating system call results in an error condition, objects of the ISystemErrorInfo class are created. You can use the error text to construct a derived class object of IException.

The Open Class Library provides the ITHROWSYSTEMERROR macro for throwing exceptions constructed with the following ISystemErrorInfo information:

This macro generates code that calls throwSystemError, which does the following:

  1. Creates an ISystemErrorInfo object
  2. Uses the object to create an IException object
  3. Adds the operatingSystem error group to the object
  4. Adds location information
  5. Logs the exception data
  6. Throws the exception

AIX Considerations

You can create objects of this class on AIX, but the objects contain no useful information and only have the default message: "System exception condition detected."


ISystemErrorInfo - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class. You cannot copy or assign objects of this class.


[view class]
~ISystemErrorInfo
public:
virtual ~ISystemErrorInfo()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ISystemErrorInfo
public:
ISystemErrorInfo( unsigned long systemErrorId, const char* systemFunctionName = 0 )

You can only construct objects of this class using the default constructor.
Note: If the constructor cannot load the error text, the Open Class Library provides the following default text: "No error text is available."

systemErrorId
The error ID identifying an operating system error.
systemFunctionName
The name of the failing system call that returned the error ID. If you specify systemFunctionName, the constructor prefixes it to the error text. Optional.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Error Information

Use these members to return error information provided by objects of this class.


[view class]
errorId
public:
virtual unsigned long errorId() const

Returns the error ID.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isAvailable
public:
virtual bool isAvailable() const

If the error information is available, true is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator const char *
public:
virtual operator const char *() const

Returns the error text.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
text
public:
virtual const char* text() const

Returns the error text.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Throw Support

Use these members to support the throwing of exceptions.


[view class]
throwSystemError
public:
static void throwSystemError( unsigned long systemErrorId, const char* functionName, const IExceptionLocation& location, IBaseErrorInfo::ExceptionType name = accessError, IException::Severity severity = IException::recoverable )

Used by the ITHROWSYSTEMERROR macro, this function creates an ISystemErrorInfo object and uses the text from it to do the following:

  1. Create an exception object
  2. Add the location information to it
  3. Log the exception data
  4. Throw the exception
systemErrorId
The error ID from the system.
functionName
The name of the function where the exception occurred.
location
An IExceptionLocation object containing the following:
  • Function name
  • File name
  • Line number where the function is called
name
Use the enumeration IBaseErrorInfo::ExceptionType to specify the type of the exception. The default is accessError.
severity
Use the enumeration IException::Severity to specify the severity of the error. The default is recoverable.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ISystemErrorInfo - Inherited Member Functions and Data

Inherited Public Functions

IBaseErrorInfo

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data