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:
- Creates an IMMErrorInfo object
- Uses the object to create an object of
IAccessError
- Adds location information
- Logs the exception data
- 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:
- Creates an IMMErrorInfo object
- Uses the object to create an IException object
- Adds location information
- Logs the exception data
- 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.
- ~IMMErrorInfo
public:
virtual ~IMMErrorInfo()
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
No |
- 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.
- errorId
public:
virtual unsigned long errorId() const
Returns the error ID.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
No |
- 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 |
- operator const char *
public:
virtual operator const char *() const
Returns the error text.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
No |
- 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.
- 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:
- Create an exception object
- Add the location information to it
- Log the exception data
- 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
-
virtual ~IBaseErrorInfo()
virtual unsigned long errorId() const = 0
IBaseErrorInfo()
virtual bool isAvailable() const = 0
virtual operator const char *() const = 0
virtual const char* text() const = 0
void
throwError( const IExceptionLocation& location,
ExceptionType name = accessError,
IException::Severity severity = IException::recoverable,
IException::ErrorCodeGroup errorGroup = IException::baseLibrary )
Inherited Public Data
Inherited Protected Functions
Inherited Protected Data