#ifndef HTERROR_H #define HTERROR_H #include "HTAccess.h"
typedef enum _HTErrorElement {
HTERR_OK = 0, /* 200 */
HTERR_CREATED, /* 201 */
HTERR_ACCEPTED, /* 202 */
HTERR_PARTIAL, /* 203 */
HTERR_NO_RESPONSE, /* 204 */
HTERR_MOVED, /* 301 */
HTERR_FOUND, /* 302 */
HTERR_METHOD, /* 303 */
HTERR_NOT_MODIFIED, /* 304 */
HTERR_BAD_REQUEST, /* 400 */
HTERR_UNAUTHORIZED, /* 401 */
HTERR_PAYMENT_REQUIRED, /* 402 */
HTERR_FORBIDDEN, /* 403 */
HTERR_NOT_FOUND, /* 404 */
HTERR_INTERNAL, /* 500 */
HTERR_NOT_IMPLEMENTED, /* 501 */
HTERR_HTTP_CODES_END, /* Put all non-HTTP status codes after this */
HTERR_NO_REMOTE_HOST,
HTERR_NO_HOST,
HTERR_FTP_SERVER,
HTERR_FTP_NO_RESPONSE,
HTERR_TIME_OUT,
HTERR_GOPHER_SERVER,
HTERR_INTERRUPTED,
HTERR_CON_INTR,
HTERR_CSO_SERVER,
HTERR_BAD_REPLY, /* HTTP */
HTERR_NEWS_SERVER,
HTERR_FILE_TO_FTP,
HTERR_MAX_REDIRECT,
HTERR_WAIS_OVERFLOW,
HTERR_WAIS_MODULE,
HTERR_WAIS_NO_CONNECT,
HTERR_SYSTEM,
HTERR_ELEMENTS /* This MUST be the last element */
} HTErrorElement;
typedef enum _HTErrSeverity {
ERR_FATAL = 0x1,
ERR_NON_FATAL = 0x2,
ERR_WARNING = 0x4,
ERR_INFO = 0x8
} HTErrSeverity;
typedef struct _HTErrorInfo {
int handle; /* Unique number in this stack */
HTErrorElement element; /* Index number into HTErrorMsgInfo */
HTErrSeverity severity; /* A la VMS */
BOOL ignore; /* YES if msg should not go to user */
void * par; /* Explanation, e.g. filename */
unsigned int par_length; /* For copying by generic routine */
char * where; /* Which function */
} HTErrorInfo;
Note: The default value is made so that it only puts a message to stderr if a `real' error has occurred. If a separate widget is available for information and error messages then probably HT_ERR_SHOW_DETAILED would be more appropriate.
typedef enum _HTErrorShow {
HT_ERR_SHOW_FATAL = 0x1,
HT_ERR_SHOW_NON_FATAL = 0x3,
HT_ERR_SHOW_WARNING = 0x7,
HT_ERR_SHOW_INFO = 0xF,
HT_ERR_SHOW_PARS = 0x10,
HT_ERR_SHOW_LOCATION = 0x20,
HT_ERR_SHOW_IGNORE = 0x40,
HT_ERR_SHOW_FIRST = 0x80,
HT_ERR_SHOW_LINKS = 0x100,
HT_ERR_SHOW_DEFAULT = 0x13,
HT_ERR_SHOW_DETAILED = 0x1F,
HT_ERR_SHOW_DEBUG = 0x7F
} HTErrorShow;
extern unsigned int HTErrorShowMask;
This is the table containing the actual error-messages and links for
more information:
typedef struct _HTErrorMsgInfo {
int code; /* Error number */
char * msg; /* Short explanation */
char * url; /* Explaning URL */
} HTErrorMsgInfo;
extern HTErrorMsgInfo error_info[];
extern int HTErrorAdd PARAMS(( HTRequest * request, HTErrSeverity severity, BOOL ignore, int element, void * par, unsigned int par_length, char * where));
extern int HTErrorSysAdd PARAMS(( HTRequest * request, HTErrSeverity severity, BOOL ignore, char * syscall));
extern void HTErrorIgnore PARAMS((HTRequest * request, int handle)); extern void HTErrorIgnoreLast PARAMS((HTRequest * request));
PUBLIC void HTErrorSetPrefix PARAMS((char *path)); PUBLIC CONST char *HTErrorGetPrefix NOPARAMS;
PUBLIC void HTErrorMsg PARAMS((HTRequest * request));
PUBLIC void HTErrorFree PARAMS((HTRequest * request));
#endifend