IGUIErrorInfo

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

The Open Class Library provides the following macros for throwing exceptions constructed with IGUIErrorInfo information:

ITHROWGUIERROR
This macro accepts as its only parameter the name of the GUI function that returned an error condition. This macro then generates code that calls IGUIError::throwGUIError, which does the following:
  1. Creates an IGUIErrorInfo object
  2. Uses the object to create an object of IAccessError
  3. Adds the presentationSystem error group to the object
  4. Adds location information
  5. Logs the exception data
  6. Throws the exception

Note: This macro uses the recoverable enumerator provided by IException::Severity.
ITHROWGUIERROR2
This macro can throw any of the Open Class Library-defined exceptions. This macro accepts the following parameters:
location
The name of the GUI function returning an error code, the name of the file the function is in, and the function's line number.
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.

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

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

Portability Considerations

You can use this class in OS/2 to create error information for GUI errors resulting from Win calls. Objects of this class obtain the error information by calling WinGetLastError, which is the Presentation Manager API that maintains the error information per thread. Motif does not have a similar mechanism where you can query the X server for error information. If you use objects of this class in AIX, they obtain a default message, which is "GUI exception condition detected."

AIX Considerations

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

OS/2 Considerations

You can use objects of the IGUIErrorInfo class to obtain information about the last error that occurred on a call to Presentation Manager.


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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IGUIErrorInfo
public:
IGUIErrorInfo(const char* GUIFunctionName = 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."

GUIFunctionName
The name of the failing GUI function. If you specify GUIFunctionName, 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

OS/2 Considerations

In the case of a Presentation Manager error, the IGUIErrorInfo constructor obtains the errorId using WinGetLastError.


[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 using information from an IGUIErrorInfo object. The throwGUIError function is used by the ITHROWGUIERROR macro.


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

Creates an IGUIErrorInfo 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.
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


IGUIErrorInfo - Inherited Member Functions and Data

Inherited Public Functions

IBaseErrorInfo

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data