src/lib/errors.h
author Tero Marttila <terom@fixme.fi>
Thu, 28 May 2009 01:17:36 +0300
branchnew-lib-errors
changeset 219 cefec18b8268
parent 218 5229a5d098b2
permissions -rw-r--r--
some of the lib/transport stuff compiles
218
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
#ifndef LIBQMSK_ERRORS_H
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
#define LIBQMSK_ERRORS_H
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
/**
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
 * @file
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
 *
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
 * Defines some errors codes for general-purpose use, or for common libraries.
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
 */
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
#include "error.h"
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
/**
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
 * General-purpose errors that may be useful and don't belong in any more specific namespace.
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
 */
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
enum general_error_code {
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
    ERR_GENERAL_NONE,
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
    ERR_MEM,                ///< memory allocation error
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
    ERR_NOT_IMPLEMENTED,    ///< function not implmented: <func>
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
    ERR_MISC,               ///< miscellaneous error: <error>
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
    ERR_CMD_OPT,            ///< invalid command line option: <error> - XXX: replace with something getopt
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
    ERR_UNKNOWN,            ///< unknown error
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
};
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
const struct error_list general_errors;
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
/**
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
 * Convenience macros
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
 */
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
#define SET_ERROR_MEM(err_state) \
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
    SET_ERROR(err_state, &general_errors, ERR_MEM)
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    30
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    31
/**
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
 * Errors for POSIX libc functions
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    33
 */
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
enum libc_error_code {
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
    ERR_LIBC_NONE,
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    36
    ERR_SIGACTION,          ///< sigaction: <perror>
219
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    37
    ERR_READ,               ///< read: <perror>
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    38
    ERR_WRITE,              ///< write: <perror>
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    39
    ERR_WRITE_EOF,          ///< write: EOF
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    40
    ERR_FCNTL,              ///< fcntl: <perror>
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    41
    ERR_CLOSE,              ///< close: <perror>
218
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    42
};
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    43
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
const struct error_list libc_errors;
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    46
/**
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
 * Errors for libevent
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    48
 */
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
enum libevent_error_code {
219
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    50
    ERR_EVENT_NONE,
218
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
    ERR_EVENT_NEW,          ///< event_new
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    52
    ERR_EVENT_ADD,          ///< event_add
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    53
    ERR_EVENT_DEL,          ///< event_del
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    54
};
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    55
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    56
const struct error_list libevent_errors;
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
219
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    58
/**
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    59
 * Errors for lua
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    60
 */
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    61
enum lua_error_code {
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    62
    ERR_LUA_NONE,
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    63
    ERR_LUA_MEM,            ///< memory error
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    64
    ERR_LUA_SYNTAX,         ///< syntax error
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    65
    ERR_LUA_RUN,            ///< runtime erorr
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    66
    ERR_LUA_ERR,            ///< error-handling error
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    67
    ERR_LUA_FILE,           ///< filesystem error
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    68
};
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    69
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    70
const struct error_list lua_errors;
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 218
diff changeset
    71
218
5229a5d098b2 some of spbot and lib compiles
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    72
#endif /* LIBQMSK_ERRORS_H */