Error
[Tools]

These functions provide error management for projects. More...

Defines

#define EINA_ERROR_PERR(fmt,...)   eina_error_print(EINA_LOG_LEVEL_ERR, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define EINA_ERROR_PINFO(fmt,...)   eina_error_print(EINA_LOG_LEVEL_INFO, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define EINA_ERROR_PWARN(fmt,...)   eina_error_print(EINA_LOG_LEVEL_WARN, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define EINA_ERROR_PDBG(fmt,...)   eina_error_print(EINA_LOG_LEVEL_DBG, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)

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.
EINA_DEPRECATED EAPI void eina_error_print (int level, const char *file, const char *fnc, int line, const char *fmt,...)
EINA_DEPRECATED EAPI void EINA_PRINTF (5, 6)
EINA_DEPRECATED EAPI void eina_error_vprint (int level, const char *file, const char *fnc, int line, const char *fmt, va_list args)
EINA_DEPRECATED EAPI void
EINA_DEPRECATED EAPI void 
eina_error_log_level_set (int level)
Eina_Bool eina_error_init (void)
Eina_Bool eina_error_shutdown (void)

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.


Define Documentation

#define EINA_ERROR_PERR ( fmt,
...   )     eina_error_print(EINA_LOG_LEVEL_ERR, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
Deprecated:

use EINA_LOG_ERR() instead.

Print the error message described with the formatted string fmt using the current print callback, file function and line, with the error level EINA_ERROR_LEVEL_ERR.

#define EINA_ERROR_PINFO ( fmt,
...   )     eina_error_print(EINA_LOG_LEVEL_INFO, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
Deprecated:

use EINA_LOG_INFO() instead.

Print the error message described with the formatted string fmt using the current print callback, file function and line, with the error level EINA_ERROR_LEVEL_INFO.

#define EINA_ERROR_PWARN ( fmt,
...   )     eina_error_print(EINA_LOG_LEVEL_WARN, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
Deprecated:

use EINA_LOG_WARN() instead.

Print the error message described with the formatted string fmt using the current print callback, file function and line, with the error level EINA_ERROR_LEVEL_WARN.

#define EINA_ERROR_PDBG ( fmt,
...   )     eina_error_print(EINA_LOG_LEVEL_DBG, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
Deprecated:

use EINA_LOG_DBG() instead.

Print the error message described with the formatted string fmt using the current print callback, file function and line, with the error level EINA_ERROR_LEVEL_DBG.


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.

EAPI void eina_error_print ( int  level,
const char *  file,
const char *  fnc,
int  line,
const char *  fmt,
  ... 
)
EAPI void eina_error_vprint ( int  level,
const char *  file,
const char *  fnc,
int  line,
const char *  fmt,
va_list  args 
)
EAPI void eina_error_log_level_set ( int  level  )