standard_exception.cpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Disable check
10 *****************************************************************************/
11 
12 #include <ecl/config/ecl.hpp>
13 #ifndef ECL_DISABLE_EXCEPTIONS
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include "../../include/ecl/exceptions/standard_exception.hpp"
20 
21 /*****************************************************************************
22 ** Namespaces
23 *****************************************************************************/
24 
25 namespace ecl {
26 
27 /*****************************************************************************
28  * Implementation [Standard Exception]
29  ****************************************************************************/
30 
31 StandardException::StandardException(const char* loc, ErrorFlag error ) :
32  Exception(loc),
33  error_flag(error)
34 {}
35 
36 StandardException::StandardException(const char* loc, ErrorFlag error, const std::string &msg ) :
37  Exception(loc),
38  error_flag(error),
39  detailed_message(msg)
40 {}
41 
42 StandardException::StandardException(const char* loc, const StandardException &e ) :
43  Exception(),
44  error_flag(e.flag()),
45  detailed_message(e.detailed_message)
46 {
47  location = std::string(loc) + "\n : " + e.location;
48 }
49 
50 const char* StandardException::what() const throw() {
51 
52  std::string what_msg;
53 
54  what_msg = what_msg + "\nLocation : " + this->location + "\n" + "Flag : " + Error(error_flag).what() + "\n";
55  if ( detailed_message.size() > 0 ) {
56  what_msg = what_msg + "Detail : " + detailed_message + "\n";
57  }
58  return what_msg.c_str();
59 }
60 
61 }; // namespace ecl
62 
63 #endif /* ECL_DISABLE_EXCEPTIONS */
ErrorFlag
ErrorFlag
ecl::Error::what
virtual const char * what() const
ecl::Exception
Virtual parent class for the ecl exceptions.
Definition: exception.hpp:57
ecl::Error
ecl::Exception::location
std::string location
Definition: exception.hpp:86
ecl::StandardException::error_flag
const ErrorFlag error_flag
Definition: standard_exception.hpp:115
ecl::StandardException
Standard exception type, provides code location and error string.
Definition: standard_exception.hpp:62
ecl::StandardException::detailed_message
std::string detailed_message
Definition: standard_exception.hpp:116
ecl::StandardException::what
const char * what() const
Definition: standard_exception.cpp:56
ecl::StandardException::StandardException
StandardException(const char *loc, ErrorFlag error)
Default constructor for standard exceptions.
Definition: standard_exception.cpp:37
ecl


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:17