Error Handling

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

Data Structures | Typedefs | Enumerations | Functions
Error Handling
Eina C++ » Tools

Functions for handling Eina errors. More...

## Data Structures
struct | efl::eina::error_category
| Specialized error category for Eina errors. More...

## Typedefs
typedef std::error_category | efl::eina::system_error_category
| `std::error_category` for Eina errors. More...

## Enumerations
enum | efl::eina::error_type
| Typesafe representation of an `Eina_Error`. More...

## Functions
Eina_Error | efl::eina::unknown_error ()
| Return a `Eina_Error` for an unknown error. More...
system_error_category const & | efl::eina::get_generic_category ()
| Gets a `std::generic_category` instance as a `eina::system_error_category`. More...
system_error_category const & | efl::eina::get_system_category ()
| Gets a `std::system_category` instance as a `eina::system_error_category`. More...
eina::system_error_category & | efl::eina::eina_error_category ()
| Get a default `eina::error_category` object. More...
eina::error_code | efl::eina::get_error_code ()
| Gets the error code for the last Eina error. More...
void | efl::eina::set_error_code (eina::error_code const &e)
| Sets an error code in the Eina library. More...
eina::error_condition | efl::eina::get_error_condition ()
| Gets the error condition for the last Eina error. More...
error_type | efl::eina::get_error_code_enum ()
| Gets the enum value of the last Eina error. More...
void | efl::eina::throw_on_error ()
| Throw an exception if there is a error set in Eina library. More...

## Detailed Description

Functions for handling Eina errors.

Integrates the Eina errors with the standard error representation defined in the `system_error` library.

## Typedef Documentation

typedef std::error_category efl::eina::system_error_category

`std::error_category` for Eina errors.

## Enumeration Type Documentation

enum efl::eina::error_type

Typesafe representation of an `Eina_Error`.

Used for improved compatibility with system_error library.

## Function Documentation

Eina_Error efl::eina::unknown_error | ( |  | ) |
| inline

Return a `Eina_Error` for an unknown error.

Returns
  `Eina_Error` indicating a unknown/external error condition.

This function returns an `Eina_Error` indicating a unknown/external error condition. When first called, this function will register the said error within the other Eina errors, together with a error message.

References eina_error_msg_static_register().

Referenced by efl::eina::set_error_code().

system_error_category const& efl::eina::get_generic_category | ( |  | ) |
| inline

Gets a `std::generic_category` instance as a `eina::system_error_category`.

Returns
  a `std::generic_category` instance as a `eina::system_error_category`.

Referenced by efl::eina::mutex::lock(), efl::eina::mutex::try_lock(), and efl::eina::mutex::unlock().

system_error_category const& efl::eina::get_system_category | ( |  | ) |
| inline

Gets a `std::system_category` instance as a `eina::system_error_category`.

Returns
  `std::system_category` instance as a `eina::system_error_category`.

eina::system_error_category& efl::eina::eina_error_category | ( |  | ) |
| inline

Get a default `eina::error_category` object.

Returns
  Reference to a static instance of an `eina::error_category`.

Referenced by efl::eina::get_error_code(), efl::eina::get_error_condition(), and efl::eina::set_error_code().

eina::error_code efl::eina::get_error_code | ( |  | ) |
| inline

Gets the error code for the last Eina error.

Returns
  `eina::error_code` for the last Eina error.

This function gets the error code for the last Eina error and consumes it. The category of the returned `eina::error_code` is `eina_error_category`.

Note
  If no errors have been occurred or if this functions have already been called after the last error occurrence a call to this function will return a default `eina::error_code` to indicates that there is no unconsumed error.

References efl::eina::eina_error_category(), eina_error_get(), and eina_error_set().

Referenced by efl::eina::mutex::lock(), efl::eina::condition_variable::notify_all(), efl::eina::condition_variable::notify_one(), efl::eina::accessor_common_base< T >::operator=(), efl::eina::value::operator=(), efl::eina::accessor< T, typename std::enable_if< !std::is_base_of<::efl::eo::concrete, T >::value, T >::type >::operator[](), efl::eina::accessor< T, typename std::enable_if< std::is_base_of<::efl::eo::concrete, T >::value, T >::type >::operator[](), efl::eina::thread::thread(), efl::eina::throw_on_error(), efl::eina::mutex::try_lock(), efl::eina::mutex::unlock(), and efl::eina::value::value().

void efl::eina::set_error_code | ( | eina::error_code const & | e | ) |
| inline

Sets an error code in the Eina library.

Parameters

  e | Error code. Should be an `eina_error_category` error.

This function sets an error code in the Eina library. If the category of the given error code is not `eina_error_category` it will register an unknown error instead.

References efl::eina::eina_error_category(), eina_error_set(), and efl::eina::unknown_error().

eina::error_condition efl::eina::get_error_condition | ( |  | ) |
| inline

Gets the error condition for the last Eina error.

Returns
  `eina::error_condition` for the last Eina error.

This function works exactly like get_error_code but returns an `eina::error_condition` object instead.

References efl::eina::eina_error_category(), eina_error_get(), and eina_error_set().

error_type efl::eina::get_error_code_enum | ( |  | ) |
| inline

Gets the enum value of the last Eina error.

Returns
  Value of the last Eina error as an `error_type`.

This function returns the error code for the last Eina error.

Differently from get_error_code and get_error_condition, this function does not consume the last error.

References eina_error_get().

void efl::eina::throw_on_error | ( |  | ) |
| inline

Throw an exception if there is a error set in Eina library.

Exceptions

  <tt>eina::system_error</tt> | containing the error identifier.

This function is meant to be used after executing a operation that may set an Eina error. If an error code has been set this function will throw an exception.

The thrown exception holds an `eina::error_code` equivalent to the one returned by get_error_code.

Like the get_error_code function, this one consumes the last error code.

References efl::eina::get_error_code().