standard_exception.cpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Disable check
00010 *****************************************************************************/
00011 
00012 #include <ecl/config/ecl.hpp>
00013 #ifndef ECL_DISABLE_EXCEPTIONS
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include "../../include/ecl/exceptions/standard_exception.hpp"
00020 
00021 /*****************************************************************************
00022 ** Namespaces
00023 *****************************************************************************/
00024 
00025 namespace ecl {
00026 
00027 /*****************************************************************************
00028  * Implementation [Standard Exception]
00029  ****************************************************************************/
00030 
00031 StandardException::StandardException(const char* loc, ErrorFlag error ) :
00032     Exception(loc),
00033     error_flag(error)
00034 {}
00035 
00036 StandardException::StandardException(const char* loc, ErrorFlag error, const std::string &msg ) :
00037     Exception(loc),
00038     error_flag(error),
00039     detailed_message(msg)
00040 {}
00041 
00042 StandardException::StandardException(const char* loc, const StandardException &e ) :
00043     Exception(),
00044     error_flag(e.flag()),
00045     detailed_message(e.detailed_message)
00046 {
00047     location = std::string(loc) + "\n         : " + e.location;
00048 }
00049 
00050 const char* StandardException::what() const throw() {
00051 
00052     std::string what_msg;
00053 
00054     what_msg = what_msg + "\nLocation : " + this->location + "\n" + "Flag     : " + Error(error_flag).what() + "\n";
00055     if ( detailed_message.size() > 0 ) {
00056         what_msg  = what_msg + "Detail   : " + detailed_message + "\n";
00057     }
00058     return what_msg.c_str();
00059 }
00060 
00061 }; // namespace ecl
00062 
00063 #endif /* ECL_DISABLE_EXCEPTIONS */


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Mon Jul 3 2017 02:21:15