These functions provide error management for projects. More...
Typedefs | |
typedef int | Eina_Error |
Error type. | |
Functions | |
EAPI Eina_Error | eina_error_msg_register (const char *msg) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT |
Register a new error type. More... | |
EAPI Eina_Error | eina_error_msg_static_register (const char *msg) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT |
Register a new error type, statically allocated message. More... | |
EAPI Eina_Bool | eina_error_msg_modify (Eina_Error error, const char *msg) EINA_ARG_NONNULL(2) |
Change the message of an already registered message. More... | |
EAPI Eina_Error | eina_error_get (void) |
Return the last set error. More... | |
EAPI void | eina_error_set (Eina_Error err) |
Set the last error. More... | |
EAPI const char * | eina_error_msg_get (Eina_Error error) EINA_PURE |
Return the description of the given an error number. More... | |
EAPI Eina_Error | eina_error_find (const char *msg) EINA_ARG_NONNULL(1) EINA_PURE |
Find the Eina_Error corresponding to a message string. More... | |
Variables | |
EAPI Eina_Error | EINA_ERROR_OUT_OF_MEMORY |
Error identifier corresponding to a lack of memory. | |
These functions provide error management for projects.
The Eina error module provides a way to manage errors in a simple but powerful way in libraries and modules. It is also used in Eina itself. Similar to libC's errno
and strerror() facilities, this is extensible and recommended for other libraries and applications.
A simple example of how to use this can be seen here.
EAPI Eina_Error eina_error_msg_register | ( | const char * | msg | ) |
Register a new error type.
msg | The description of the error. It will be duplicated using eina_stringshare_add(). |
This function stores in a list the error message described by msg
. The returned value is a unique identifier greater or equal than 1. The description can be retrieve later by passing to eina_error_msg_get() the returned value.
References EAPI, eina_stringshare_add(), and EINA_TRUE.
EAPI Eina_Error eina_error_msg_static_register | ( | const char * | msg | ) |
Register a new error type, statically allocated message.
msg | The description of the error. This string will not be duplicated and thus the given pointer should live during usage of eina_error. |
This function stores in a list the error message described by msg
. The returned value is a unique identifier greater or equal than 1. The description can be retrieve later by passing to eina_error_msg_get() the returned value.
References EAPI, and EINA_FALSE.
EAPI Eina_Bool eina_error_msg_modify | ( | Eina_Error | error, |
const char * | msg | ||
) |
Change the message of an already registered message.
error | The Eina_Error to change the message of |
msg | The description of the error. This string will be duplicated only if the error was registered with eina_error_msg_register otherwise it must remain intact for the duration. |
This function modifies the message associated with error
and changes it to msg
. If the error was previously registered by eina_error_msg_static_register then the string will not be duplicated, otherwise the previous message will be unrefed and msg
copied.
References EAPI, EINA_FALSE, eina_stringshare_add(), eina_stringshare_del(), and EINA_TRUE.
EAPI Eina_Error eina_error_get | ( | void | ) |
Return the last set error.
This function returns the last error set by eina_error_set(). The description of the message is returned by eina_error_msg_get().
References EAPI.
EAPI void eina_error_set | ( | Eina_Error | err | ) |
Set the last error.
err | The error identifier. |
This function sets the last error identifier. The last error can be retrieved with eina_error_get().
err
should be 0
. References EAPI.
Referenced by edje_edit_program_transition_value1_get(), edje_edit_program_transition_value1_set(), edje_edit_program_transition_value2_get(), edje_edit_program_transition_value2_set(), edje_edit_state_image_border_fill_set(), edje_edit_state_image_border_set(), and edje_edit_state_image_set().
EAPI const char* eina_error_msg_get | ( | Eina_Error | error | ) |
Return the description of the given an error number.
error | The error number. |
This function returns the description of an error that has been registered with eina_error_msg_register(). If an incorrect error is given, then NULL
is returned.
References EAPI.
EAPI Eina_Error eina_error_find | ( | const char * | msg | ) |
Find the Eina_Error corresponding to a message string.
msg | The error message string to match (NOT NULL ) |
msg
, or 0 on failure This function attempts to match msg
with its corresponding Eina_Error value. If no such value is found, 0 is returned.