CUBA
excep.hh
1 
8 #ifndef EXCEP_HH_
9 #define EXCEP_HH_
10 
11 #include <stdexcept>
12 #include <exception>
13 #include <string>
14 
15 using std::runtime_error;
16 using std::exception;
17 using std::string;
18 
19 namespace ruba {
20 
24 class cuba_runtime_error: public runtime_error {
25 public:
27  runtime_error("") {
28  }
29  cuba_runtime_error(const std::string& msg) :
30  runtime_error(msg) {
31  }
32 };
33 
37 class cuba_exception: public exception {
38 public:
39  string message;
40  short code;
41 
42  inline cuba_exception() :
43  message(""), code(-1) {
44 
45  }
46 
47  inline cuba_exception(const string& message, const short& code = -1) :
48  message(message), code(code) {
49  } // must provide some message
50 
51  virtual const char* what() const throw () {
52  return message.c_str();
53  }
54 };
55 
56 }
57 #endif /* EXCEP_HH_ */
customized runtime error class
Definition: excep.hh:24
Definition: cpda.cc:10
customized exception
Definition: excep.hh:37