IXLibErrorInfo

The IXLibErrorInfo class represents error information that you can include in an exception object. When an X Library call results in an error condition, objects of the IXLibErrorInfo class are created. IThread registers a handler through XSetErrorHandler to do the following:

You can use this error code to obtain the information about the X Library error. When you have an X Library function call fail, construct an object of this class to obtain the error text. You can use the error text to construct a derived class object of IException.

The Open Class Library provides the ITHROWXLIBERROR macro for throwing exceptions constructed with IXLibErrorInfo information. This macro has the following parameters:

location
The name of the X Library function returning an error code.
name
Use the enumeration 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.

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

  1. Creates an IXLibErrorInfo object
  2. Uses the object to create an IException object
  3. Adds location information
  4. Logs the exception data
  5. Throws the exception

Portability Considerations

The IXLibErrorInfo class is provided for versions of the product that run on X/Windows-based windowing systems. On OS/2, MVS and AS/400 releases of the library, this class is not supported.

OS/2 Considerations

The OS/2 release of the Open Class Library does not support this class.


IXLibErrorInfo - 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]
~IXLibErrorInfo
public:
virtual ~IXLibErrorInfo()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IXLibErrorInfo
public:
IXLibErrorInfo(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."

systemFunctionName
The name of the failing X Library function. 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 X error code, which you can use to obtain the error text.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

If the error text 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]
throwXLibError
public:
static void throwXLibError( const char* functionName, const IExceptionLocation& location, IBaseErrorInfo::ExceptionType name = accessError, IException::Severity severity = IException::recoverable )

This function is used by the ITHROWCLIBERROR macro. The function creates an IXLibErrorInfo object and uses the text from it to do the following:

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


IXLibErrorInfo - Inherited Member Functions and Data

Inherited Public Functions

IBaseErrorInfo

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data