- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Typedefs | Functions | Variables
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) 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.

## Detailed Description

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.

## 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 eina_stringshare_add().

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()

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

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()

References EINA_FALSE.

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.

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.

See Also
  eina_error_msg_register()

References EINA_FALSE, eina_stringshare_add(), eina_stringshare_del(), and EINA_TRUE.

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().

Note
  This is also used to clear previous errors, in that case `err` should be `0`.

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.

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 Eina_Error eina_error_find | ( | const char * | msg | ) |

Find the Eina_Error corresponding to a message string.

Parameters

  msg | The error message string to match (NOT `NULL`)

Returns
  The Eina_Error matching `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.