Annotation of parser3/src/main/pa_exception.C, revision 1.17
1.13 parser 1: /** @file
2: Parser: exception class.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.16 parser 5: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.13 parser 6:
1.17 ! parser 7: $Id: pa_exception.C,v 1.16 2001/09/26 10:32:26 parser Exp $
1.13 parser 8: */
9:
10: #include "pa_common.h"
11: #include "pa_exception.h"
12:
13: void Exception::_throw(const String *atype, const String *acode,
14: const String *aproblem_source,
15: const char *comment_fmt, ...) const {
1.15 parser 16: //_asm int 3;
1.13 parser 17: ftype=atype;
18: fcode=acode;
19: fproblem_source=aproblem_source;
20:
21: if(comment_fmt) {
22: va_list args;
23: va_start(args, comment_fmt);
24: vsnprintf(fcomment, MAX_STRING, comment_fmt, args);
25: va_end(args);
26: } else
27: fcomment[0]=0;
28:
29: longjmp(mark, 1);
30: }
1.17 ! parser 31:
! 32: void Exception::_throw(Pool& pool, const String *source, const XSLException& e) {
! 33: if(e.getURI().empty())
! 34: _throw(0, 0,
! 35: source,
! 36: "%s (%s)",
! 37: pool.transcode_cstr(e.getMessage()), // message for exception
! 38: pool.transcode_cstr(e.getType()) // type of exception
! 39: );
! 40: else
! 41: _throw(0, 0,
! 42: source,
! 43: "%s (%s). %s(%d:%d)'",
! 44: pool.transcode_cstr(e.getMessage()), // message for exception
! 45: pool.transcode_cstr(e.getType()), // type of exception
! 46:
! 47: pool.transcode_cstr(e.getURI()), // URI for the associated document, if any
! 48: e.getLineNumber(), // line number, or -1 if unknown
! 49: e.getColumnNumber() // column number, or -1 if unknown
! 50: );
! 51: }
! 52:
! 53: void Exception::_throw(Pool& pool, const String *source, const SAXException& e) {
! 54: _throw(0, 0,
! 55: source,
! 56: "%s",
! 57: pool.transcode_cstr(XalanDOMString(e.getMessage())) // message for exception
! 58: );
! 59: }
! 60: void Exception::_throw(Pool& pool, const String *source, const SAXParseException& e) {
! 61: _throw(0, 0,
! 62: source,
! 63: "%s. %s(%d:%d)",
! 64: pool.transcode_cstr(XalanDOMString(e.getMessage())), // message for exception
! 65: e.getSystemId()?pool.transcode_cstr(XalanDOMString(e.getSystemId())):"block", // file of exception
! 66: e.getLineNumber(), e.getColumnNumber() // line:col
! 67: );
! 68: }
! 69:
! 70:
! 71: void Exception::_throw(Pool& pool, const String *source, const XMLException& e) {
! 72: _throw(0, 0,
! 73: source,
! 74: "%s (%s). %s(%d)'",
! 75: pool.transcode_cstr(XalanDOMString(e.getMessage())), // message for exception
! 76: pool.transcode_cstr(XalanDOMString((e.getType()))), // type of exception
! 77:
! 78: e.getSrcFile()?e.getSrcFile():"block", // file of exception
! 79: e.getSrcLine() // line number
! 80: //e.getCode()
! 81: );
! 82: }
! 83:
! 84: void Exception::_throw(Pool& pool, const String *source, const XalanDOMException& e) {
! 85: const char *s;
! 86: int code=(int)e.getExceptionCode();
! 87: switch(code) {
! 88: case 1: s="INDEX_SIZE_ERR"; break;
! 89: case 2: s="DOMSTRING_SIZE_ERR"; break;
! 90: case 3: s="HIERARCHY_REQUEST_ERR"; break;
! 91: case 4: s="WRONG_DOCUMENT_ERR"; break;
! 92: case 5: s="INVALID_CHARACTER_ERR"; break;
! 93: case 6: s="NO_DATA_ALLOWED_ERR"; break;
! 94: case 7: s="NO_MODIFICATION_ALLOWED_ERR"; break;
! 95: case 8: s="NOT_FOUND_ERR"; break;
! 96: case 9: s="NOT_SUPPORTED_ERR"; break;
! 97: case 10: s="INUSE_ATTRIBUTE_ERR"; break;
! 98: case 11: s="INVALID_STATE_ERR"; break;
! 99: case 12: s="SYNTAX_ERR"; break;
! 100: case 13: s="INVALID_MODIFICATION_ERR"; break;
! 101: case 14: s="NAMESPACE_ERR"; break;
! 102: case 15: s="INVALID_ACCESS_ERR"; break;
! 103: case 201: s="UNKNOWN_ERR"; break;
! 104: case 202: s="TRANSCODING_ERR"; break;
! 105: default: s="<UNKNOWN CODE>"; break;
! 106: }
! 107: _throw(0, 0,
! 108: source,
! 109: "XalanDOMException %s (%d)",
! 110: s, // decoded code of exception
! 111: code // code of exception
! 112: );
! 113: }
! 114:
E-mail: