dmi_error_message

Synopsis

#include <opendmi/error.h>

const char *dmi_error_message(dmi_error_code_t reason);

Description

The dmi_error_message function returns a human-readable string describing the error identified by reason. The returned pointer refers to a static string; the caller must not free or modify it.

If reason is out of range or has no associated message, the function returns "Unknown error".

Parameters

reason

Error reason code.

Return value

Returns a pointer to a static null-terminated string. Never returns nullptr.

Errors

None.

Examples

dmi_error_t *error = dmi_error_get_last(context);
if (error != nullptr) {
    fprintf(stderr, "error: %s\n", dmi_error_message(error->reason));
    dmi_error_clear(context);
}