src/error.c
changeset 37 4fe4a3c4496e
parent 31 98ea2bd59195
child 41 40f7aa051acb
equal deleted inserted replaced
36:791d7a5532e2 37:4fe4a3c4496e
     8 #include <string.h>
     8 #include <string.h>
     9 #include <stdio.h>
     9 #include <stdio.h>
    10 
    10 
    11 struct error_desc _core_error_desc[] = {
    11 struct error_desc _core_error_desc[] = {
    12     {   ERR_CALLOC,                         "calloc",                                   ERR_EXTRA_NONE      },
    12     {   ERR_CALLOC,                         "calloc",                                   ERR_EXTRA_NONE      },
       
    13     {   ERR_STRDUP,                         "strdup",                                   ERR_EXTRA_NONE      },
    13     {   ERR_GETADDRINFO,                    "getaddrinfo",                              ERR_EXTRA_GAI       },
    14     {   ERR_GETADDRINFO,                    "getaddrinfo",                              ERR_EXTRA_GAI       },
    14     {   ERR_GETADDRINFO_EMPTY,              "getaddrinfo: no results",                  ERR_EXTRA_NONE      },
    15     {   ERR_GETADDRINFO_EMPTY,              "getaddrinfo: no results",                  ERR_EXTRA_NONE      },
    15     {   ERR_EVENT_NEW,                      "event_new",                                ERR_EXTRA_NONE      },
    16     {   ERR_EVENT_NEW,                      "event_new",                                ERR_EXTRA_NONE      },
    16     {   ERR_EVENT_ADD,                      "event_add",                                ERR_EXTRA_NONE      },
    17     {   ERR_EVENT_ADD,                      "event_add",                                ERR_EXTRA_NONE      },
    17     {   ERR_EVSQL_NEW_PQ,                   "evsql_new_pq",                             ERR_EXTRA_NONE      },
    18     {   ERR_EVSQL_NEW_PQ,                   "evsql_new_pq",                             ERR_EXTRA_NONE      },
    37     {   ERR_GNUTLS_RECORD_SEND,             "gnutls_record_send",                       ERR_EXTRA_GNUTLS    },
    38     {   ERR_GNUTLS_RECORD_SEND,             "gnutls_record_send",                       ERR_EXTRA_GNUTLS    },
    38     {   ERR_GNUTLS_RECORD_RECV,             "gnutls_record_recv",                       ERR_EXTRA_GNUTLS    },
    39     {   ERR_GNUTLS_RECORD_RECV,             "gnutls_record_recv",                       ERR_EXTRA_GNUTLS    },
    39     {   ERR_GNUTLS_RECORD_GET_DIRECTION,    "gnutls_record_get_direction",              ERR_EXTRA_GNUTLS    },
    40     {   ERR_GNUTLS_RECORD_GET_DIRECTION,    "gnutls_record_get_direction",              ERR_EXTRA_GNUTLS    },
    40     {   _ERR_INVALID,                       NULL,                                       0                   }
    41     {   _ERR_INVALID,                       NULL,                                       0                   }
    41 
    42 
       
    43 }, _irc_proto_error_desc[] = {
       
    44     {   ERR_LINE_TOO_LONG,                  "IRC line is too long",                     ERR_EXTRA_NONE      },
       
    45     {   ERR_LINE_INVALID_TOKEN,             "Illegal token value for IRC line",         ERR_EXTRA_NONE      },
       
    46     {   ERR_INVALID_NM,                     "Invalid nickmask",                         ERR_EXTRA_NONE      },
       
    47     {   ERR_INVALID_NICK_LENGTH,            "Nickname is too long",                     ERR_EXTRA_NONE      },
       
    48     {   _ERR_INVALID,                       NULL,                                       0                   }
    42 };
    49 };
    43 
    50 
    44 /**
    51 /**
    45  * Array of error_desc tables
    52  * Array of error_desc tables
    46  */
    53  */
    47 static struct error_desc* _desc_tables[] = {
    54 static struct error_desc* _desc_tables[] = {
    48     _core_error_desc,
    55     _core_error_desc,
    49     _sock_error_desc,
    56     _sock_error_desc,
    50     _sock_gnutls_error_desc,
    57     _sock_gnutls_error_desc,
       
    58     _irc_proto_error_desc,
    51     NULL
    59     NULL
    52 };
    60 };
    53 
    61 
    54 /**
    62 /**
    55  * Look up the error_desc for the given error code
    63  * Look up the error_desc for the given error code