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

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

Webmaster