MySQL NDB Cluster API Developer Guide  /  ...  /  MGM API Error Handling Functions

3.2.2 MGM API Error Handling Functions

This section provides information about MGM API functions used for error handling.

Each MGM API error is characterised by an error code and an error message. There may also be an error description that provides additional information about the error. The MGM API includes functions to obtain this information in the event of an error.

ndb_mgm_get_latest_error()

Description

This function is used to get the latest error code associated with a given management server handle.

Prior to NDB 7.4.8, this function was not safe for use with NULL. In later versions, ndb_mgm_get_latest_error() is null-safe but returns an arbitrary value. (Bug #78130, Bug #21651706)

Signature
int ndb_mgm_get_latest_error
    (
      const NdbMgmHandle handle
    )
Parameters

An NdbMgMHandle.

Return value

An error code corresponding to an ndb_mgm_error value. You can obtain the related error message using ndb_mgm_get_latest_error_msg().

ndb_mgm_get_latest_error_msg()

Description

This function is used to obtain the latest general error message associated with an NdbMgmHandle.

Prior to NDB 7.4.8, this function was not safe for use with NULL. In later versions, ndb_mgm_get_latest_error_msg() is null-safe but returns an arbitrary value. (Bug #78130, Bug #21651706)

Signature
const char* ndb_mgm_get_latest_error_msg
    (
      const NdbMgmHandle handle
    )
Parameters

An NdbMgmHandle.

Return value

The error message text. More specific information can be obtained using ndb_mgm_get_latest_error_desc()-

ndb_mgm_get_latest_error_desc()

Description

Get the most recent error description associated with an NdbMgmHandle; this description provides additional information regarding the error message.

Prior to NDB 7.4.8, this function was not safe for use with NULL. In later versions, ndb_mgm_get_latest_error_desc() is null-safe but returns an arbitrary value. (Bug #78130, Bug #21651706)

Signature
const char* ndb_mgm_get_latest_error_desc
    (
      const NdbMgmHandle handle
    )
Parameters

An NdbMgmHandle.

Return value

The error description text.

ndb_mgm_set_error_stream()

Description

The function can be used to set the error output stream.

Signature
void ndb_mgm_set_error_stream
    (
      NdbMgmHandle handle,
      FILE*        file
    )
Parameters

This function requires two parameters:

  • An NdbMgmHandle

  • A pointer to the file to which errors are to be sent.

Return value

None.