IMMErrorInfo

The IMMErrorInfo class represents error information that you can include in an exception object. When an multimedia call results in an error condition, objects of the IMMErrorInfo 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 IMMErrorInfo information.

ITHROWMMERROR
Accepts the following parameters:
error
The multimedia error number.
functionName
The name of the multimedia function that returned an error condition.
This macro then generates code that calls IMMErrorInfo::throwMMError, which does the following:
  1. Creates an IMMErrorInfo object
  2. Uses the object to create an object of IAccessError
  3. Adds location information
  4. Logs the exception data
  5. Throws the exception

Note: This macro uses the recoverable enumerator provided by IException::Severity.
ITHROWMMERROR2
Throws any of the Open Class Library-defined exceptions. This macro accepts the following parameters:
error
The multimedia error number.
location
The name of the multimedia function returning an error code, the name of the file the function is in, and the function's line number.
type
Use the enumeration IBaseErrorInfo::ExceptionType to specify the type of the exception. The Open Class Library uses accessError as the default type on its exceptions.
severity
Use the enumeration IException::Severity to specify the severity of the error. The Open Class Library uses recoverable as the default severity on its exceptions.

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

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


IMMErrorInfo - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class. You cannot create copies of objects of this class.


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

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
IMMErrorInfo
public:
IMMErrorInfo( unsigned long errorId = 0, const char* functionName = 0 )

There is only one way to construct instances of this class. If the error number and the name of the failing API is passed in, it will be prefixed to the error text. If the error text cannot be loaded, the following default text is provided: "No error text is available."

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Error Information

Use these members to query the accessible attributes of this class.


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

Returns the error ID.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


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

If there is error text available for the error, returns true.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


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

Returns the error text.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


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

Returns the error text.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Throw Support

Use these members to support throwing of exceptions. The ITHROWMMERROR macro uses these members.


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

Creates an IMMErrorInfo 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
errorId
The error number for the exception.
functionName
The name of the function (probably a system function) that failed.
location
An IExceptionLocation object containing the following:
  • Function name where the failure was detected and the exception thrown
  • 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 No


IMMErrorInfo - Inherited Member Functions and Data

Inherited Public Functions

IBaseErrorInfo

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data