NG_Exception.hpp
1 #ifndef NG_EXCEPTION_HPP_INCLUDED
2 #define NG_EXCEPTION_HPP_INCLUDED
3 
4 #include <string>
5 #include <exception>
6 #include <typeinfo>
7 
8 #include <DM/config.hpp>
9 
10 /// Exception wrapper
11 /** \author VK,BW
12  \date 12.12.12 */
13 class DM_API NG_exception : public std::exception
14 {
15 private:
16  std::string reason;
17 public:
18  NG_exception() {};
19  NG_exception(std::string a_reason) : reason(a_reason) {};
20  NG_exception(const char *a_reason) : reason(a_reason) {};
21 
22  virtual const char* what() const noexcept { return reason.c_str(); };
23 };
24 
25 class NG_bad_cast : public std::bad_cast
26 {
27 private:
28  std::string reason;
29 public:
30  NG_bad_cast() {};
31  NG_bad_cast(std::string a_reason) : reason(a_reason) {};
32  NG_bad_cast(const char *a_reason) : reason(a_reason) {};
33 
34  virtual const char* what() const noexcept { return reason.c_str(); };
35 };
36 
37 
38 #endif
Exception wrapper.
Definition: NG_Exception.hpp:13
Definition: NG_Exception.hpp:25