00001 /******************************************************************************* 00002 00003 Copyright (C) 2007 by Brendon Costa 00004 00005 This library is free software; you can redistribute it and/or modify 00006 it under the terms of the "LGPL Like" License defined in the file COPYING 00007 that should have been distributed along with this source. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 You should have received a copy of the "LGPL Like" License 00014 along with this library; see the file COPYING. if not, it can be 00015 obtained from the EDoc++ website: 00016 http://edoc.sourceforge.net/license.html 00017 00018 *******************************************************************************/ 00019 #include "config.h" 00020 00021 #include "EDoc/exceptions.h" 00022 00023 namespace EDoc 00024 { 00025 //======================================================================== 00026 Throwable::Throwable(const char* type_name_in, 00027 const char* file_in, 00028 int line_in, 00029 std::string user_message_in, 00030 std::string dev_message_in) : 00031 00032 type_name(type_name_in), 00033 file(file_in), 00034 line(line_in), 00035 user_message(user_message_in), 00036 dev_message(dev_message_in) 00037 { 00038 std::ostringstream stream; 00039 stream << file << ":" 00040 << line << ": " 00041 << user_message 00042 << " (dev): " << dev_message; 00043 detailed_message = stream.str(); 00044 } 00045 //======================================================================== 00046 const char* Throwable::what() const throw() 00047 { 00048 return detailed_message.c_str(); 00049 } 00050 //======================================================================== 00051 std::string Throwable::GetType() const 00052 { 00053 return type_name; 00054 } 00055 //======================================================================== 00056 std::string Throwable::GetFile() const 00057 { 00058 return file; 00059 } 00060 //======================================================================== 00061 int Throwable::GetLine() const 00062 { 00063 return line; 00064 } 00065 //======================================================================== 00066 std::string Throwable::GetUserMessage() const 00067 { 00068 return user_message; 00069 } 00070 //======================================================================== 00071 std::string Throwable::GetDevMessage() const 00072 { 00073 return dev_message; 00074 } 00075 //======================================================================== 00076 00077 }