--- parser3/src/main/pa_exception.C 2001/10/13 15:12:50 1.18 +++ parser3/src/main/pa_exception.C 2001/10/22 16:44:42 1.22 @@ -4,15 +4,15 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_exception.C,v 1.18 2001/10/13 15:12:50 parser Exp $ + $Id: pa_exception.C,v 1.22 2001/10/22 16:44:42 parser Exp $ */ #include "pa_common.h" #include "pa_exception.h" -void Exception::_throw(const String *atype, const String *acode, +Exception::Exception(const String *atype, const String *acode, const String *aproblem_source, - const char *comment_fmt, ...) const { + const char *comment_fmt, ...) { //_asm int 3; ftype=atype; fcode=acode; @@ -21,25 +21,24 @@ void Exception::_throw(const String *aty if(comment_fmt) { va_list args; va_start(args, comment_fmt); + fcomment=(char *)malloc(MAX_STRING); vsnprintf(fcomment, MAX_STRING, comment_fmt, args); va_end(args); } else - fcomment[0]=0; - - longjmp(mark, 1); + fcomment=0; } #ifdef XML -void Exception::_throw(Pool& pool, const String *source, const XSLException& e) { +void Exception::provide_source(Pool& pool, const String *source, const XSLException& e) { if(e.getURI().empty()) - _throw(0, 0, + throw Exception(0, 0, source, "%s (%s)", pool.transcode_cstr(e.getMessage()), // message for exception pool.transcode_cstr(e.getType()) // type of exception ); else - _throw(0, 0, + throw Exception(0, 0, source, "%s (%s). %s(%d:%d)'", pool.transcode_cstr(e.getMessage()), // message for exception @@ -51,15 +50,15 @@ void Exception::_throw(Pool& pool, const ); } -void Exception::_throw(Pool& pool, const String *source, const SAXException& e) { - _throw(0, 0, +void Exception::provide_source(Pool& pool, const String *source, const SAXException& e) { + throw Exception(0, 0, source, "%s", pool.transcode_cstr(XalanDOMString(e.getMessage())) // message for exception ); } -void Exception::_throw(Pool& pool, const String *source, const SAXParseException& e) { - _throw(0, 0, +void Exception::provide_source(Pool& pool, const String *source, const SAXParseException& e) { + throw Exception(0, 0, source, "%s. %s(%d:%d)", pool.transcode_cstr(XalanDOMString(e.getMessage())), // message for exception @@ -69,12 +68,12 @@ void Exception::_throw(Pool& pool, const } -void Exception::_throw(Pool& pool, const String *source, const XMLException& e) { - _throw(0, 0, +void Exception::provide_source(Pool& pool, const String *source, const XMLException& e) { + throw Exception(0, 0, source, "%s (%s). %s(%d)'", pool.transcode_cstr(XalanDOMString(e.getMessage())), // message for exception - pool.transcode_cstr(XalanDOMString((e.getType()))), // type of exception + pool.transcode_cstr(XalanDOMString(e.getType())), // type of exception e.getSrcFile()?e.getSrcFile():"block", // file of exception e.getSrcLine() // line number @@ -82,7 +81,7 @@ void Exception::_throw(Pool& pool, const ); } -void Exception::_throw(Pool& pool, const String *source, const XalanDOMException& e) { +void Exception::provide_source(Pool& pool, const String *source, const XalanDOMException& e) { const char *s; int code=(int)e.getExceptionCode(); switch(code) { @@ -105,7 +104,7 @@ void Exception::_throw(Pool& pool, const case 202: s="TRANSCODING_ERR"; break; default: s=""; break; } - _throw(0, 0, + throw Exception(0, 0, source, "XalanDOMException %s (%d)", s, // decoded code of exception