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

2.1       frystyk     1: <HTML>
                      2: <HEAD>
                      3: <TITLE>Error message module for libwww</TITLE>
                      4: <NEXTID N="z1">
                      5: </HEAD>
                      6: <BODY>
                      7: <H1>Error reporting functions</H1>
                      8: 
                      9: <PRE>
                     10: #ifndef HTERROR_H
                     11: #define HTERROR_H
                     12: </PRE>
                     13: 
                     14: <PRE>
                     15: typedef enum _HTErrorShow {
2.2     ! frystyk    16:     HT_ERR_SHOW_FATAL     = 0x1,
        !            17:     HT_ERR_SHOW_NON_FATAL = 0x3,
        !            18:     HT_ERR_SHOW_WARNING   = 0x7,
2.1       frystyk    19:     HT_ERR_SHOW_PARS     = 0x8,
                     20:     HT_ERR_SHOW_LOCATION  = 0x10,
                     21:     HT_ERR_SHOW_IGNORE    = 0x20,
                     22:     HT_ERR_SHOW_FIRST     = 0x40,
                     23:     HT_ERR_SHOW_ALL      = 0x3F
                     24: } HTErrorShow;
                     25: 
                     26: typedef enum _HTErrSeverity {
2.2     ! frystyk    27:     ERR_FATAL            = 0x1,
        !            28:     ERR_NON_FATAL        = 0x3,
        !            29:     ERR_WARNING          = 0x7
2.1       frystyk    30: } HTErrSeverity;
                     31: </PRE>
                     32: 
                     33: <H2>Error Numbers</H2>
                     34: 
                     35: <B>Note:</B> All non-HTTP error codes have index numbers &gt; HTERR_HTTP_CODES, and they will not be shown in the error-message generated.
                     36: <PRE>
                     37: typedef enum _HTErrorElement {
                     38:        HTERR_OK = 0,                                           /* 200 */
                     39:        HTERR_CREATED,                                          /* 201 */
                     40:        HTERR_ACCEPTED,                                         /* 202 */
                     41:        HTERR_PARTIAL,                                          /* 203 */
                     42:        HTERR_NO_RESPONSE,                                      /* 204 */
                     43:        HTERR_MOVED,                                            /* 301 */
                     44:        HTERR_FOUND,                                            /* 302 */
                     45:        HTERR_METHOD,                                           /* 303 */
                     46:        HTERR_NOT_MODIFIED,                                     /* 304 */
                     47:        HTERR_BAD_REQUEST,                                      /* 400 */
                     48:        HTERR_UNAUTHORIZED,                                     /* 401 */
                     49:        HTERR_PAYMENT_REQUIRED,                                 /* 402 */
                     50:        HTERR_FORBIDDEN,                                        /* 403 */
                     51:        HTERR_NOT_FOUND,                                        /* 404 */
                     52:        HTERR_INTERNAL,                                         /* 500 */
                     53:        HTERR_NOT_IMPLEMENTED,                                  /* 501 */
                     54:        HTERR_HTTP_CODES_END,    /* Put all non-HTTP status codes after this */
                     55:        HTERR_NO_REMOTE_HOST,
                     56:        HTERR_FTP_SERVER,
                     57:        HTERR_FTP_NO_RESPONSE,
                     58:        HTERR_TIME_OUT,
2.2     ! frystyk    59:        HTERR_GOPHER_SERVER,
        !            60:        HTERR_INTERRUPTED,
        !            61:        HTERR_CSO_SERVER,
        !            62:        HTERR_SYSTEM,
2.1       frystyk    63:        HTERR_ELEMENTS                      /* This MUST be the last element */
                     64: } HTErrorElement;
                     65: </PRE>
                     66: 
                     67: <H2>Public Error Functions</H2>
                     68: 
2.2     ! frystyk    69: <H3>Initializing Help</H3>
2.1       frystyk    70: 
2.2     ! frystyk    71: A path must be given in order to initialize the help pages, that refer to any further explanation of the error or warning. Furthermore, it is possible to sign any error message as, e.g., `CERN HTTP Server' and give a link to get more info on the signer.
2.1       frystyk    72: <PRE>
2.2     ! frystyk    73: extern void HTErrorInit PARAMS((char * pathname,
        !            74:                                char * signature,
        !            75:                                char * siglink));
2.1       frystyk    76: </PRE>
                     77: 
                     78: <H3>Add an Error Message</H3>
                     79: 
                     80: This function adds an error message to the error_stack list in the HTRequest
                     81: structure.
                     82: <PRE>
                     83: extern void HTErrorAdd PARAMS((        HTRequest *     request,
                     84:                                HTErrSeverity   severity,
                     85:                                BOOL            ignore,
                     86:                                int             element,
                     87:                                void *          par,
                     88:                                unsigned int    par_length,
                     89:                                char *          where));
2.2     ! frystyk    90: </PRE>
        !            91: 
        !            92: <H3>Add a System Error Message</H3>
        !            93: 
        !            94: This function adds an error from a system call that initializes errno or equivalent and adds it to the error_stack list in the HTRequest structure.
        !            95: <PRE>
        !            96: extern void HTErrorSysAdd PARAMS((HTRequest *  request,
        !            97:                                  HTErrSeverity severity,
        !            98:                                  BOOL          ignore,
        !            99:                                  char *        syscall));
2.1       frystyk   100: </PRE>
                    101: 
                    102: <H3>Ignoring an Error Message</H3>
                    103: 
                    104: If an error message is not to be send to the user, e.g., output to the stream, then the ignore flag must be turn on. This function turns it on for the latest error appended to the list.
                    105: <PRE>
                    106: extern void HTErrorIgnore PARAMS((HTRequest * request));
                    107: </PRE>
                    108: 
                    109: <H3>Generating an Error Message</H3>
                    110: 
                    111: This function writes to the outpu stream for the request.
                    112: <PRE>
                    113: extern void HTErrorMsg    PARAMS((HTRequest * request));
                    114: </PRE>
                    115: 
                    116: <H3>Freeing an Error List</H3>
                    117: 
                    118: This is normally done when the HTRequest structure is freed but it might be done at any other time in order to ignore a whole series of errors.
                    119: <PRE>
                    120: extern void HTErrorFree   PARAMS((HTRequest * request));
                    121: </PRE>
                    122: 
                    123: <PRE>
                    124: #endif
                    125: </PRE>
                    126: end
                    127: </BODY>
                    128: </HTML>
                    129: 
                    130: 

Webmaster