Next Previous Contents

3.4 Error handling

When function in API succeeds it returns value 0. When error has occured -1 is returned. The error (or errors) which occured are returned in parameter ERR_PARAM. The errors are returned in list (actually GList is used). For manipulating with this list three functions are defined:

struct user_error *err_get_struct(GList **param);

This function removes oldest error from the list and returns pointer to it.

char *err_struct_to_string(struct user_error *err, ERR_PARAM);

This function will create user presentable form of error message. Note that error can occur while creating error message (that's the reason for ERR_PARAM as an argument).

char *err_get_string(GList **param, ERR_PARAM);

Wrapper which calls err_get_struct(), err_get_string(), frees struct user_param and returns formated string.

See Error System for detailed description of error handling.


Next Previous Contents