00001 // LICENSE: (Please see the file COPYING for details) 00002 // 00003 // NUS - Nemesis Utilities System: A C++ application development framework 00004 // Copyright (C) 2006, 2007 Otavio Rodolfo Piske 00005 // 00006 // This file is part of NUS 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Lesser General Public 00010 // License as published by the Free Software Foundation version 2.1 00011 // of the License. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Lesser General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Lesser General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 // 00022 #include "nxmlerror.h" 00023 00024 NXmlError::NXmlError(void) { } 00025 00026 00027 NXmlException NXmlError::getLastError(const NString &msg, Flag flag) { 00028 NXmlException ret; 00029 NString description = msg; 00030 xmlErrorPtr err; 00031 00032 err = xmlGetLastError(); 00033 ret.setModule(NException::XML); 00034 if (!err) { 00035 ret.setDescription(description); 00036 return ret; 00037 } 00038 00039 description += ": "; 00040 description += err->message; 00041 if (err->file) { 00042 description += NSTR("on file ") + err->file + NSTR(" "); 00043 } 00044 00045 if (err->line > 0) { 00046 description += NSTR("at line ") + NString::number(err->line); 00047 } 00048 00049 ret.setDescription(description); 00050 ret.setFlag(flag); 00051 return ret; 00052 }