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