Xively Official / mbed-libxively-5d6fdd4

Dependents:   xively-jumpstart-demo

Embed: (wiki syntax)

« Back to documentation index

xi_err.h File Reference

xi_err.h File Reference

Error handling (POSIX-like) More...

Go to the source code of this file.

Functions

xi_err_t xi_get_last_error (void)
 Error getter for the user.
void xi_set_err (xi_err_t e)
 Error setter for the library itself.
const char * xi_get_error_string (xi_err_t e)
 Error description string getter for a given value of `xi_err_t`.

Variables

const char * xi_err_string [XI_ERR_COUNT]
 Error description lookup table.

Detailed Description

Error handling (POSIX-like)

Author:
Olgierd Humenczuk * Every function should return a value * There are special values (usually `0` or `-1`) which indicate occurrence of an error * User can detect and lookup errors using declarations below

Definition in file xi_err.h.


Function Documentation

const char* xi_get_error_string ( xi_err_t  e )

Error description string getter for a given value of `xi_err_t`.

Definition at line 58 of file xi_err.c.

xi_err_t xi_get_last_error ( void   )

Error getter for the user.

Returns:
The `xi_err_t` structure which can be converted to a string using `xi_get_error_string()` method.
Warning:
It resets the last error value, so it's always a good idea to make a copy of it!

Definition at line 46 of file xi_err.c.

void xi_set_err ( xi_err_t  e )

Error setter for the library itself.

Note:
Current implementation used a global state variable (_errno_), which is not thread-safe. If thread-safety is required, than _errno_ should be made thread-local.

Definition at line 53 of file xi_err.c.


Variable Documentation

const char* xi_err_string[XI_ERR_COUNT]

Error description lookup table.

Definition at line 15 of file xi_err.c.