Annotation of libwww/Library/src/HTError.html, revision 2.33

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.26      frystyk     3: <TITLE>Error Manager</TITLE>
2.33    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 26-Feb-1996 -->
2.1       frystyk     5: <NEXTID N="z1">
                      6: </HEAD>
                      7: <BODY>
2.18      frystyk     8: 
2.9       frystyk     9: <H1>Reporting Errors and Messages to the Client</H1>
2.1       frystyk    10: 
2.18      frystyk    11: <PRE>
                     12: /*
2.22      frystyk    13: **     (c) COPYRIGHT MIT 1995.
2.18      frystyk    14: **     Please first read the full copyright statement in the file COPYRIGH.
                     15: */
                     16: </PRE>
                     17: 
2.30      frystyk    18: This is the implementaion of an error message reporting system that
                     19: reports errors occured either in a stream module (structured streams
                     20: inclusive) or in a protocol module. A list of errors are put into the
                     21: a list which can be bound to a request object or to a stream. <P>
2.18      frystyk    22: 
                     23: This module is implemented by <A HREF="HTError.c">HTError.c</A>, and
2.30      frystyk    24: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     25: Reference Library</A>.
2.4       frystyk    26: 
2.1       frystyk    27: <PRE>
                     28: #ifndef HTERROR_H
                     29: #define HTERROR_H
2.28      frystyk    30: #include "HTReq.h"
2.1       frystyk    31: </PRE>
                     32: 
2.30      frystyk    33: <A NAME="errorinfo"><H2>Error Codes and Messages</H2></A>
2.1       frystyk    34: 
2.15      frystyk    35: <NOTE><B>Note: </B></NOTE> All non-HTTP error codes have index numbers
                     36: &gt; HTERR_HTTP_CODES, and they will not be shown in the error-message
                     37: generated.
                     38: 
2.1       frystyk    39: <PRE>
                     40: typedef enum _HTErrorElement {
                     41:        HTERR_OK = 0,                                           /* 200 */
                     42:        HTERR_CREATED,                                          /* 201 */
                     43:        HTERR_ACCEPTED,                                         /* 202 */
                     44:        HTERR_PARTIAL,                                          /* 203 */
2.23      frystyk    45:        HTERR_NO_CONTENT,                                       /* 204 */
2.1       frystyk    46:        HTERR_MOVED,                                            /* 301 */
                     47:        HTERR_FOUND,                                            /* 302 */
                     48:        HTERR_METHOD,                                           /* 303 */
                     49:        HTERR_NOT_MODIFIED,                                     /* 304 */
                     50:        HTERR_BAD_REQUEST,                                      /* 400 */
                     51:        HTERR_UNAUTHORIZED,                                     /* 401 */
                     52:        HTERR_PAYMENT_REQUIRED,                                 /* 402 */
                     53:        HTERR_FORBIDDEN,                                        /* 403 */
                     54:        HTERR_NOT_FOUND,                                        /* 404 */
2.20      frystyk    55:        HTERR_NOT_ALLOWED,                                      /* 405 */
                     56:        HTERR_NONE_ACCEPTABLE,                                  /* 406 */
                     57:        HTERR_PROXY,                                            /* 407 */
                     58:        HTERR_TIMEOUT,                                          /* 408 */
2.1       frystyk    59:        HTERR_INTERNAL,                                         /* 500 */
                     60:        HTERR_NOT_IMPLEMENTED,                                  /* 501 */
2.20      frystyk    61:        HTERR_BAD_GATE,                                         /* 502 */
                     62:        HTERR_DOWN,                                             /* 503 */
                     63:        HTERR_GATE_TIMEOUT,                                     /* 504 */
2.1       frystyk    64:        HTERR_HTTP_CODES_END,    /* Put all non-HTTP status codes after this */
                     65:        HTERR_NO_REMOTE_HOST,
2.13      frystyk    66:        HTERR_NO_HOST,
2.31      frystyk    67:        HTERR_NO_FILE,
2.1       frystyk    68:        HTERR_FTP_SERVER,
                     69:        HTERR_FTP_NO_RESPONSE,
                     70:        HTERR_TIME_OUT,
2.2       frystyk    71:        HTERR_GOPHER_SERVER,
                     72:        HTERR_INTERRUPTED,
2.13      frystyk    73:        HTERR_CON_INTR,
2.2       frystyk    74:        HTERR_CSO_SERVER,
2.20      frystyk    75:        HTERR_HTTP09,
                     76:        HTERR_BAD_REPLY,
2.16      frystyk    77:        HTERR_UNKNOWN_AA,
2.5       frystyk    78:        HTERR_NEWS_SERVER,
2.7       frystyk    79:        HTERR_FILE_TO_FTP,
2.8       frystyk    80:        HTERR_MAX_REDIRECT,
2.16      frystyk    81:        HTERR_EOF,
2.14      frystyk    82:        HTERR_WAIS_OVERFLOW,
                     83:        HTERR_WAIS_MODULE,
2.12      frystyk    84:        HTERR_WAIS_NO_CONNECT,
2.2       frystyk    85:        HTERR_SYSTEM,
2.29      frystyk    86:        HTERR_CLASS,
2.31      frystyk    87:        HTERR_ACCESS,
                     88:        HTERR_LOGIN,
2.1       frystyk    89:        HTERR_ELEMENTS                      /* This MUST be the last element */
                     90: } HTErrorElement;
2.30      frystyk    91: </PRE>
2.19      roeber     92: 
2.30      frystyk    93: <H2>Creation and Deletion Methods</H2>
                     94: 
                     95: <H3>Add an Error</H3>
                     96: 
                     97: Add an error message to the error list. `par' and `where' might be set
                     98: to NULL. If par is a string, it is sufficient to let length be
                     99: unspecified, i.e., 0. If only a part of the string is wanted then
                    100: specify a length inferior to strlen((char *) par).  The string is '\0'
                    101: terminated automaticly.  See also HTError_addSystem for system errors. Returns YES if OK, else NO.
                    102: 
                    103: <PRE>
                    104: typedef struct _HTError HTError;
                    105: 
                    106: typedef enum _HTSeverity {
2.33    ! frystyk   107:     ERR_UNKNOWN                  = 0x0,
2.3       frystyk   108:     ERR_FATAL            = 0x1,
2.7       frystyk   109:     ERR_NON_FATAL        = 0x2,
2.20      frystyk   110:     ERR_WARN             = 0x4,
2.7       frystyk   111:     ERR_INFO             = 0x8
2.30      frystyk   112: } HTSeverity;
                    113: 
                    114: extern BOOL HTError_add (HTList *      list,
                    115:                         HTSeverity     severity,
                    116:                         BOOL           ignore,
                    117:                         int            element,
                    118:                         void *         par,
                    119:                         unsigned int   length,
                    120:                         char *         where);
                    121: 
                    122: </PRE>
                    123: 
                    124: <H3>Add a System Error</H3>
                    125: 
                    126: Add a system error message to the error list. syscall is the name of
                    127: the system call, e.g. "close". The message put to the list is that
                    128: corresponds to the error number passed. See also HTError_add. Returns
                    129: YES if OK, else NO.
                    130: 
                    131: <PRE>
                    132: extern BOOL HTError_addSystem (HTList *                list,
                    133:                               HTSeverity       severity,
                    134:                               int              errornumber,
                    135:                               BOOL             ignore,
                    136:                               char *           syscall);
                    137: </PRE>
                    138: 
                    139: 
                    140: <H3>Delete an Entire Error Stack</H3>
2.3       frystyk   141: 
2.30      frystyk   142: Deletes all errors in a list.
                    143: 
                    144: <PRE>
                    145: extern BOOL HTError_deleteAll (HTList * list);
2.1       frystyk   146: </PRE>
                    147: 
2.30      frystyk   148: <H3>Deletes the Last Edded Entry</H3>
                    149: 
                    150: Deletes the last error entry added to the list. Return YES if OK, else NO
                    151: 
                    152: <PRE>
                    153: extern BOOL HTError_deleteLast (HTList * list);
                    154: </PRE>
                    155: 
                    156: <H2>How Should Errors be Presented</H2>
2.3       frystyk   157: 
2.15      frystyk   158: This variable dictates which errors should be put out when generating
                    159: the message to the user. The first four enumerations make it possible
                    160: to see `everything as bad or worse than' this level, e.g.
                    161: HT_ERR_SHOW_NON_FATAL shows messages of type HT_ERR_SHOW_NON_FATAL and
                    162: HT_ERR_SHOW_FATAL. <P>
                    163: 
                    164: <B>Note:</B> The default value is made so that it only puts a message
                    165: to <EM>stderr</EM> if a `real' error has occurred. If a separate
                    166: widget is available for information and error messages then probably
                    167: HT_ERR_SHOW_DETAILED would be more appropriate.
2.3       frystyk   168: 
                    169: <PRE>
                    170: typedef enum _HTErrorShow {
                    171:     HT_ERR_SHOW_FATAL     = 0x1,
                    172:     HT_ERR_SHOW_NON_FATAL = 0x3,
                    173:     HT_ERR_SHOW_WARNING   = 0x7,
2.6       frystyk   174:     HT_ERR_SHOW_INFO     = 0xF,
                    175:     HT_ERR_SHOW_PARS     = 0x10,
                    176:     HT_ERR_SHOW_LOCATION  = 0x20,
                    177:     HT_ERR_SHOW_IGNORE    = 0x40,
                    178:     HT_ERR_SHOW_FIRST     = 0x80,
2.15      frystyk   179:     HT_ERR_SHOW_LINKS     = 0x100,
2.7       frystyk   180:     HT_ERR_SHOW_DEFAULT          = 0x13,
                    181:     HT_ERR_SHOW_DETAILED  = 0x1F,
2.10      frystyk   182:     HT_ERR_SHOW_DEBUG    = 0x7F
2.3       frystyk   183: } HTErrorShow;
                    184: 
2.30      frystyk   185: extern HTErrorShow HTError_show (void);
                    186: extern BOOL HTError_setShow (HTErrorShow mask);
2.3       frystyk   187: </PRE>
2.1       frystyk   188: 
2.30      frystyk   189: <H3>Show the Error Entry?</H3>
                    190: 
                    191: Should we show this entry in the list or just continue to the next one?
2.1       frystyk   192: 
                    193: <PRE>
2.30      frystyk   194: extern BOOL HTError_doShow (HTError * info);
2.1       frystyk   195: </PRE>
                    196: 
2.30      frystyk   197: <H2>Ignore last Added Error</H2>
2.3       frystyk   198: 
2.30      frystyk   199: Turns on the `ignore' flag for the most recent error entered the
                    200: error list. Returns YES if OK else NO
2.1       frystyk   201: 
                    202: <PRE>
2.30      frystyk   203: extern BOOL HTError_ignoreLast (HTList * list);
                    204: extern BOOL HTError_setIgnore  (HTError * info);
2.2       frystyk   205: </PRE>
                    206: 
2.31      frystyk   207: <H2>Methods for Accessing the Error Object</H2>
2.2       frystyk   208: 
2.31      frystyk   209: The definition of the error code and the error message is not part of
                    210: the core Libray. Only the definition of the Error object itself
                    211: is. This object has an index number defined by the
                    212: <CODE>HTErrorElement</CODE> above. The mapping from this index to an
                    213: erro code and a message is for the application to do. The Library
2.32      frystyk   214: provides a default implementation in the <A HREF="HTDialog.html">
                    215: HTDialog module</A>. These are the methods for accessing the error
                    216: object:
2.15      frystyk   217: 
                    218: <PRE>
2.31      frystyk   219: extern int HTError_index               (HTError * info);
2.30      frystyk   220: extern HTSeverity HTError_severity     (HTError * info);
                    221: extern void * HTError_parameter                (HTError * info, int * length);
                    222: extern CONST char * HTError_location   (HTError * info);
2.1       frystyk   223: </PRE>
                    224: 
                    225: <PRE>
                    226: #endif
                    227: </PRE>
2.30      frystyk   228: End of Declaration Manager
2.1       frystyk   229: </BODY>
                    230: </HTML>
                    231: 
                    232: 

Webmaster