The IException class is the base class from which all exception objects thrown in the library are derived. None of the functions in this class throws exceptions because an exception has probably already been thrown or is about to be thrown. Member functions in the Open Class Library create objects of classes derived from IException for all error conditions the functions encounter. Each exception object contains the following:
The library defines the derived classes so that you can catch exceptions by their type. In general, never create an IException object. Instead, create and throw an object of the appropriate derived class. The derived classes of IException are the following:
In addition, IResourceExhausted has the following derived classes: You can also derive your own exception type from IException.The Open Class Library provides the following macros to assist in using exception handling. If you derive your own exception type and you want to use a macro, you must use the ITHROW macro or write your own macro.
Whenever the Open Class Library throws one of these exceptions, trace records are output with information about the exception. The class ITrace describes tracing in more detail.
You can construct and destruct objects of this class. You cannot assign one IException object from another.
![]() |
public:
virtual ~IException()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
You can construct objects of this class by doing the following:
public:
IException(const IException& exception)
The Open Class Library provides this constructor so the compiler can copy the exception when it is thrown.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IException( const char* errorText, unsigned long errorId = 0, Severity severity = IException::unrecoverable )
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members provide support for terminating an application instead of throwing an exception.
![]() |
public:
virtual void terminate()
Ends the application. Normally, the Open Class Library only intends this function to be used internally by the library's exception-handling macros when the compiler you are using does not support C++ exception handling. This only occurs if you define the INO_EXCEPTIONS_SUPPORT macro. The macros that use this function are as follows:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to determine which class library an exception originated from.
![]() |
public:
ErrorCodeGroup errorCodeGroup() const
Returns the error group the exception originated from.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IException& setErrorCodeGroup(ErrorCodeGroup errorGroup)
Sets the ID of the originating class library into the exception object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static ErrorCodeGroup const baseLibrary
Specifies the error group for Open Class Library errors.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static ErrorCodeGroup const CLibrary
Specifies the error group for the C library errors.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static ErrorCodeGroup const operatingSystem
Specifies the error group for operating system errors.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static ErrorCodeGroup const other
Specifies the error group for errors which do not fall in any of the other groups.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static ErrorCodeGroup const presentationSystem
Specifies the error group for presentation system errors.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to get or modify the error identifier of the exception object.
![]() |
public:
unsigned long errorId() const
Returns the error ID of the exception.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IException& setErrorId(unsigned long errorId)
Sets the error ID to the specified value.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to set and access the location information in the exception object.
![]() |
public:
virtual IException& addLocation( const IExceptionLocation& location )
Adds the location information to the exception object. The Open Class Library captures this information when an exception is thrown or rethrown. An array of IExceptionLocation objects is stored in the exception object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
const IExceptionLocation* locationAtIndex( unsigned long locationIndex ) const
Returns the IExceptionLocation object at the specified index.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
unsigned long locationCount() const
Returns the number of locations stored in the exception location array.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to log exception information.
![]() |
public:
virtual IException& logExceptionData()
Logs the exception data stored in the IException object using the function specified by IException::setTraceFunction. If you have not set a tracing function, the exception information is written to standard error output.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static IException::TraceFn* setTraceFunction( IException::TraceFn& traceFunction )
Registers an object of IException::TraceFn to be used to log exception data. The ITrace member functions and macros write the trace messages. IException::logExceptionData calls IException::TraceFn::write during exception processing to write the data. If you do not register an object, data is written to standard error output.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to set and determine the severity of the error condition.
![]() |
public:
virtual int isRecoverable() const
If the thrower (that is, whatever creates the exception) determines the exception is recoverable, 1 is returned. If the thrower determines it is unrecoverable, 0 is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IException& setSeverity(Severity severity)
Sets the severity of the exception.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to set, modify, and retrieve the exception text in the object.
![]() |
public:
IException& appendText(const char* errorText)
Appends the specified text to the text string on the top of the exception text stack.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IException& setText(const char* errorText)
Adds the specified text to the top of the exception text stack.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
const char* text(unsigned long indexFromTop = 0) const
Returns a constant char* pointing to an exception text string from the exception text stack.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
unsigned long textCount() const
Returns the number of text strings in the exception text stack.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to determine the name (type) of the exception. This is used for logging out an exception object's error information.
![]() |
public:
virtual const char* name() const
Returns the name of the object's class.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members support the throwing of exceptions.
![]() |
public:
static void assertParameter( const char* exceptionText, IExceptionLocation location )
The IASSERT macro uses this function to do the following:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
enum Severity { unrecoverable, recoverable }
Use these enumerators to specify the severity of the exception:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
typedef const char * ErrorCodeGroup
This identifies the source of the exception's error code.
Windows | OS/2 | AIX |
Yes | Yes | Yes |