The error handling API supports checking the error status of PDI. More...
Classes | |
struct | PDI_errhandler_t |
Definition of an error handler. More... | |
Typedefs | |
typedef void(* | PDI_errfunc_f) (PDI_status_t status, const char *message, void *context) |
Type of a callback function used when an error occurs. More... | |
Enumerations | |
enum | PDI_status_t { PDI_OK = 0, PDI_UNAVAILABLE, PDI_ERR_CONFIG, PDI_ERR_VALUE, PDI_ERR_PLUGIN, PDI_ERR_IMPL, PDI_ERR_SYSTEM, PDI_ERR_STATE, PDI_ERR_RIGHT, PDI_ERR_TYPE } |
Error codes of PDI. More... | |
Functions | |
const char * | PDI_errmsg (void) |
Return a human-readabe message describing the last error that occured in PDI. More... | |
PDI_errhandler_t | PDI_errhandler (PDI_errhandler_t handler) |
Sets the error handler to use. More... | |
Variables | |
const PDI_errhandler_t | PDI_ASSERT_HANDLER |
Prints the error message and aborts if the status is invalid. More... | |
const PDI_errhandler_t | PDI_WARN_HANDLER |
Prints the error message and continue if the status is invalid. More... | |
const PDI_errhandler_t | PDI_NULL_HANDLER |
Does nothing. More... | |
The error handling API supports checking the error status of PDI.
By default, errors in PDI C API are signaled by a return code of type PDI_status_t and an error message can be retrieved with the PDI_errmsg function. This default behavior can be changed by replacing the error handler with the PDI_errhandler function.
struct PDI_errhandler_t |
Definition of an error handler.
Class Members | ||
---|---|---|
PDI_errfunc_f | func | The function to handle the error (none if NULL) |
void * | context | the context that will be provided to the function |
typedef void(* PDI_errfunc_f) (PDI_status_t status, const char *message, void *context) |
Type of a callback function used when an error occurs.
status | the error code |
message | the human-readable error message |
context | a user-provided context |
enum PDI_status_t |
Error codes of PDI.
const char* PDI_errmsg | ( | void | ) |
Return a human-readabe message describing the last error that occured in PDI.
PDI_errhandler_t PDI_errhandler | ( | PDI_errhandler_t | handler | ) |
Sets the error handler to use.
PDI_asserthandler is the default handler before this function is called
handler | the new handler to set |
const PDI_errhandler_t PDI_ASSERT_HANDLER |
Prints the error message and aborts if the status is invalid.
const PDI_errhandler_t PDI_WARN_HANDLER |
Prints the error message and continue if the status is invalid.
const PDI_errhandler_t PDI_NULL_HANDLER |
Does nothing.