#ifndef LIBQMSK_ERRORS_H
#define LIBQMSK_ERRORS_H
/**
* @file
*
* Defines some errors codes for general-purpose use, or for common libraries.
*/
#include "error.h"
/**
* General-purpose errors that may be useful and don't belong in any more specific namespace.
*/
enum general_error_code {
ERR_GENERAL_NONE,
ERR_MEM, ///< memory allocation error
ERR_NOT_IMPLEMENTED, ///< function not implmented: <func>
ERR_MISC, ///< miscellaneous error: <error>
ERR_CMD_OPT, ///< invalid command line option: <error> - XXX: replace with something getopt
ERR_UNKNOWN, ///< unknown error
};
const struct error_list general_errors;
/**
* Convenience macros
*/
#define SET_ERROR_MEM(err_state) \
SET_ERROR(err_state, &general_errors, ERR_MEM)
/**
* Errors for POSIX libc functions
*/
enum libc_error_code {
ERR_LIBC_NONE,
ERR_SIGACTION, ///< sigaction: <perror>
ERR_READ, ///< read: <perror>
ERR_WRITE, ///< write: <perror>
ERR_WRITE_EOF, ///< write: EOF
ERR_FCNTL, ///< fcntl: <perror>
ERR_CLOSE, ///< close: <perror>
};
const struct error_list libc_errors;
/**
* Errors for libevent
*/
enum libevent_error_code {
ERR_EVENT_NONE,
ERR_EVENT_NEW, ///< event_new
ERR_EVENT_ADD, ///< event_add
ERR_EVENT_DEL, ///< event_del
};
const struct error_list libevent_errors;
/**
* Errors for lua
*/
enum lua_error_code {
ERR_LUA_NONE,
ERR_LUA_MEM, ///< memory error
ERR_LUA_SYNTAX, ///< syntax error
ERR_LUA_RUN, ///< runtime erorr
ERR_LUA_ERR, ///< error-handling error
ERR_LUA_FILE, ///< filesystem error
};
const struct error_list lua_errors;
#endif /* LIBQMSK_ERRORS_H */