src/error.c
branchmodules
changeset 55 6f7f6ae729d0
parent 41 40f7aa051acb
child 56 942370000450
equal deleted inserted replaced
54:9f74e924b01a 55:6f7f6ae729d0
     2 #include "error.h"
     2 #include "error.h"
     3 
     3 
     4 // for the error_desc tables
     4 // for the error_desc tables
     5 #include "sock.h"
     5 #include "sock.h"
     6 #include "sock_gnutls.h"
     6 #include "sock_gnutls.h"
       
     7 #include "module.h"
     7 
     8 
     8 #include <string.h>
     9 #include <string.h>
     9 #include <stdio.h>
    10 #include <stdio.h>
    10 
    11 
    11 struct error_desc _core_error_desc[] = {
    12 struct error_desc _core_error_desc[] = {
    44     {   ERR_LINE_TOO_LONG,                  "IRC line is too long",                     ERR_EXTRA_NONE      },
    45     {   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_LINE_INVALID_TOKEN,             "Illegal token value for IRC line",         ERR_EXTRA_NONE      },
    46     {   ERR_INVALID_NM,                     "Invalid nickmask",                         ERR_EXTRA_NONE      },
    47     {   ERR_INVALID_NM,                     "Invalid nickmask",                         ERR_EXTRA_NONE      },
    47     {   ERR_INVALID_NICK_LENGTH,            "Nickname is too long",                     ERR_EXTRA_NONE      },
    48     {   ERR_INVALID_NICK_LENGTH,            "Nickname is too long",                     ERR_EXTRA_NONE      },
    48     {   _ERR_INVALID,                       NULL,                                       0                   }
    49     {   _ERR_INVALID,                       NULL,                                       0                   }
       
    50 }, _module_error_desc[] = {
       
    51     {   ERR_MODULE_OPEN,                    "module dlopen() failed",                   ERR_EXTRA_NONE      },
       
    52     {   ERR_MODULE_NAME,                    "invalid module name",                      ERR_EXTRA_NONE      },
       
    53     {   ERR_MODULE_INIT_FUNC,               "invalid module init func",                 ERR_EXTRA_NONE      },
       
    54     {   _ERR_INVALID,                       NULL,                                       0                   }
    49 };
    55 };
    50 
    56 
    51 /**
    57 /**
    52  * Array of error_desc tables
    58  * Array of error_desc tables
    53  */
    59  */
    54 static struct error_desc* _desc_tables[] = {
    60 static struct error_desc* _desc_tables[] = {
    55     _core_error_desc,
    61     _core_error_desc,
    56     _sock_error_desc,
    62     _sock_error_desc,
    57     _sock_gnutls_error_desc,
    63     _sock_gnutls_error_desc,
    58     _irc_proto_error_desc,
    64     _irc_proto_error_desc,
       
    65     _module_error_desc,
    59     NULL
    66     NULL
    60 };
    67 };
    61 
    68 
    62 /**
    69 /**
    63  * Look up the error_desc for the given error code
    70  * Look up the error_desc for the given error code