Annotation of libwww/Library/src/HTError.html, revision 2.31
2.1 frystyk 1: <HTML>
2: <HEAD>
2.26 frystyk 3: <TITLE>Error Manager</TITLE>
2.31 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 19-Nov-1995 -->
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: > 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.3 frystyk 107: ERR_FATAL = 0x1,
2.7 frystyk 108: ERR_NON_FATAL = 0x2,
2.20 frystyk 109: ERR_WARN = 0x4,
2.7 frystyk 110: ERR_INFO = 0x8
2.30 frystyk 111: } HTSeverity;
112:
113: extern BOOL HTError_add (HTList * list,
114: HTSeverity severity,
115: BOOL ignore,
116: int element,
117: void * par,
118: unsigned int length,
119: char * where);
120:
121: </PRE>
122:
123: <H3>Add a System Error</H3>
124:
125: Add a system error message to the error list. syscall is the name of
126: the system call, e.g. "close". The message put to the list is that
127: corresponds to the error number passed. See also HTError_add. Returns
128: YES if OK, else NO.
129:
130: <PRE>
131: extern BOOL HTError_addSystem (HTList * list,
132: HTSeverity severity,
133: int errornumber,
134: BOOL ignore,
135: char * syscall);
136: </PRE>
137:
138:
139: <H3>Delete an Entire Error Stack</H3>
2.3 frystyk 140:
2.30 frystyk 141: Deletes all errors in a list.
142:
143: <PRE>
144: extern BOOL HTError_deleteAll (HTList * list);
2.1 frystyk 145: </PRE>
146:
2.30 frystyk 147: <H3>Deletes the Last Edded Entry</H3>
148:
149: Deletes the last error entry added to the list. Return YES if OK, else NO
150:
151: <PRE>
152: extern BOOL HTError_deleteLast (HTList * list);
153: </PRE>
154:
155: <H2>How Should Errors be Presented</H2>
2.3 frystyk 156:
2.15 frystyk 157: This variable dictates which errors should be put out when generating
158: the message to the user. The first four enumerations make it possible
159: to see `everything as bad or worse than' this level, e.g.
160: HT_ERR_SHOW_NON_FATAL shows messages of type HT_ERR_SHOW_NON_FATAL and
161: HT_ERR_SHOW_FATAL. <P>
162:
163: <B>Note:</B> The default value is made so that it only puts a message
164: to <EM>stderr</EM> if a `real' error has occurred. If a separate
165: widget is available for information and error messages then probably
166: HT_ERR_SHOW_DETAILED would be more appropriate.
2.3 frystyk 167:
168: <PRE>
169: typedef enum _HTErrorShow {
170: HT_ERR_SHOW_FATAL = 0x1,
171: HT_ERR_SHOW_NON_FATAL = 0x3,
172: HT_ERR_SHOW_WARNING = 0x7,
2.6 frystyk 173: HT_ERR_SHOW_INFO = 0xF,
174: HT_ERR_SHOW_PARS = 0x10,
175: HT_ERR_SHOW_LOCATION = 0x20,
176: HT_ERR_SHOW_IGNORE = 0x40,
177: HT_ERR_SHOW_FIRST = 0x80,
2.15 frystyk 178: HT_ERR_SHOW_LINKS = 0x100,
2.7 frystyk 179: HT_ERR_SHOW_DEFAULT = 0x13,
180: HT_ERR_SHOW_DETAILED = 0x1F,
2.10 frystyk 181: HT_ERR_SHOW_DEBUG = 0x7F
2.3 frystyk 182: } HTErrorShow;
183:
2.30 frystyk 184: extern HTErrorShow HTError_show (void);
185: extern BOOL HTError_setShow (HTErrorShow mask);
2.3 frystyk 186: </PRE>
2.1 frystyk 187:
2.30 frystyk 188: <H3>Show the Error Entry?</H3>
189:
190: Should we show this entry in the list or just continue to the next one?
2.1 frystyk 191:
192: <PRE>
2.30 frystyk 193: extern BOOL HTError_doShow (HTError * info);
2.1 frystyk 194: </PRE>
195:
2.30 frystyk 196: <H2>Ignore last Added Error</H2>
2.3 frystyk 197:
2.30 frystyk 198: Turns on the `ignore' flag for the most recent error entered the
199: error list. Returns YES if OK else NO
2.1 frystyk 200:
201: <PRE>
2.30 frystyk 202: extern BOOL HTError_ignoreLast (HTList * list);
203: extern BOOL HTError_setIgnore (HTError * info);
2.2 frystyk 204: </PRE>
205:
2.31 ! frystyk 206: <H2>Methods for Accessing the Error Object</H2>
2.2 frystyk 207:
2.31 ! frystyk 208: The definition of the error code and the error message is not part of
! 209: the core Libray. Only the definition of the Error object itself
! 210: is. This object has an index number defined by the
! 211: <CODE>HTErrorElement</CODE> above. The mapping from this index to an
! 212: erro code and a message is for the application to do. The Library
! 213: provides a default implementation in the <A HREF="HTMsg.html">HTMsg
! 214: module</A>. These are the methods for accessing the error object:
2.15 frystyk 215:
216: <PRE>
2.31 ! frystyk 217: extern int HTError_index (HTError * info);
2.30 frystyk 218: extern HTSeverity HTError_severity (HTError * info);
219: extern void * HTError_parameter (HTError * info, int * length);
220: extern CONST char * HTError_location (HTError * info);
2.1 frystyk 221: </PRE>
222:
223: <PRE>
224: #endif
225: </PRE>
2.30 frystyk 226: End of Declaration Manager
2.1 frystyk 227: </BODY>
228: </HTML>
229:
230:
Webmaster