00001 //---------------------------------------------------------------------------- 00002 /** @file BenzeneException.cpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #include <iostream> 00007 #include "BenzeneException.hpp" 00008 00009 using namespace benzene; 00010 00011 //---------------------------------------------------------------------------- 00012 00013 BenzeneException::BenzeneException() 00014 : std::exception(), 00015 m_stream("") 00016 { 00017 } 00018 00019 BenzeneException::BenzeneException(const std::string& message) 00020 : std::exception(), 00021 m_stream(message) 00022 { 00023 } 00024 00025 BenzeneException::BenzeneException(const BenzeneException& other) 00026 : std::exception() 00027 { 00028 m_stream << other.Response(); 00029 m_stream.copyfmt(other.m_stream); 00030 } 00031 00032 BenzeneException::~BenzeneException() throw() 00033 { 00034 } 00035 00036 const char* BenzeneException::what() const throw() 00037 { 00038 // Cannot just do 'Response().c_str()' because the temporary will die 00039 // before the message is printed. 00040 m_what = Response(); 00041 return m_what.c_str(); 00042 } 00043 00044 //---------------------------------------------------------------------------- 00045