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_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.

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.

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.

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.

See also:
eina_error_msg_register()
EAPI Eina_Error eina_error_get ( void   ) 

Return the last set error.

Returns:
The last error.

This function returns the last error set by eina_error_set(). The description of the message is returned by eina_error_msg_get().

EAPI void eina_error_set ( Eina_Error  err  ) 

Set the last error.

Parameters:
err The error identifier.

This function sets the last error identifier. The last error can be retrieved with eina_error_get().

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.

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.