Access an error descriptor

The error descriptor is an opaque structure. You must use the DataBlade® API functions in the following table to access information within it.
Table 1. Accessor functions for an error descriptor
Error-descriptor information Description DataBlade® API function
Error or warning message The text of the error or warning message mi_errmsg()
Exception or error level An MI_Exception event has an exception level that indicates the type of exception that has occurred: a warning (MI_WARNING) or a runtime error (MI_EXCEPTION)

An MI_Client_Library_Error event has an error level to indicate the type of error that has occurred. For a list of possible client LIBMI error levels, see Client LIBMI errors.

mi_error_level()
SQLSTATE value A five-character status value that is compliant with ANSI and X/Open standards. For more information, see The SQLSTATE status value. mi_error_sql_state()
SQLCODE value A database server-specific status value that contains an integer value. For more information, see SQLCODE status value. mi_error_sqlcode()
Each of the DataBlade® API functions in preceding table requires that you pass in a pointer to a valid error descriptor.
Restriction: The MI_ERROR_DESC structure is an opaque structure to DataBlade® API modules. Do not access its internal fields directly. The internal structure of MI_ERROR_DESC might change in future releases. Therefore, to create portable code, always use the accessor functions in Accessor functions for an error descriptor to obtain values from this structure.

For a sample callback that obtains information from an error descriptor, see the excpt_callback2() function in Associate a user-defined error structure with a callback.