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 
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 
43  Exception(),
44  error_flag(e.flag()),
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 */
virtual const char * what() const
const char * what() const
Virtual parent class for the ecl exceptions.
Definition: exception.hpp:49
Standard exception type, provides code location and error string.
StandardException(const char *loc, ErrorFlag error)
Default constructor for standard exceptions.
std::string location
Definition: exception.hpp:68
const ErrorFlag & flag() const
Flag enumerating the type of exception thrown.


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:12