Error
[Tools]
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) |
Register a new error type. | |
EAPI Eina_Error | eina_error_msg_static_register (const char *msg) |
Register a new error type, statically allocated message. | |
EAPI Eina_Bool | eina_error_msg_modify (Eina_Error error, const char *msg) |
Change the message of an already registered message. | |
EAPI Eina_Error | eina_error_get (void) |
Return the last set error. | |
EAPI void | eina_error_set (Eina_Error err) |
Set the last error. | |
EAPI const char * | eina_error_msg_get (Eina_Error error) |
Return the description of the given an error number. | |
Variables | |
EAPI Eina_Error | EINA_ERROR_OUT_OF_MEMORY |
Error identifier corresponding to a lack of memory. |
Detailed Description
These functions provide error management for projects.To use the error system Eina must be initialized with eina_init() and later shut down with eina_shutdown(). Error codes are registered with eina_error_msg_register() and converted from identifier to original message string with eina_error_msg_get().
Logging functions are not in eina_error anymore, see eina_log_print() instead.
Function Documentation
EAPI Eina_Error eina_error_msg_register | ( | const char * | msg | ) |
Register a new error type.
- Parameters:
-
msg The description of the error. It will be duplicated using strdup().
- Returns:
- The unique number identifier for this error.
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.
- See also:
- eina_error_msg_static_register()
EAPI Eina_Error eina_error_msg_static_register | ( | const char * | msg | ) |
Register a new error type, statically allocated message.
- Parameters:
-
msg The description of the error. This string will not be duplicated and thus the given pointer should live during usage of eina_error.
- Returns:
- The unique number identifier for this error.
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.
- See also:
- eina_error_msg_register()
EAPI Eina_Bool eina_error_msg_modify | ( | Eina_Error | error, | |
const char * | msg | |||
) |
Change the message of an already registered message.
- Parameters:
-
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
- Returns:
- EINA_TRUE if successful, EINA_FALSE on error
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 freed and msg
copied.
- See also:
- eina_error_msg_register()
EAPI Eina_Error eina_error_get | ( | void | ) |
Return the last set error.
- Returns:
- The last error.
EAPI void eina_error_set | ( | Eina_Error | err | ) |
Set the last error.
- Parameters:
-
err The error identifier.
EAPI const char * eina_error_msg_get | ( | Eina_Error | error | ) |
Return the description of the given an error number.
- Parameters:
-
error The error number.
- Returns:
- The description of the error.
NULL
is returned.