hmbdc
simplify-high-performance-messaging-programming
Exception.hpp
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 
4 #include <sstream>
5 #include <stdexcept>
6 
7 #define HMBDC_THROW(Exception, x) {\
8  std::ostringstream os;\
9  os << x << " at " << __FILE__ << ':' << __LINE__;\
10  throw Exception(os.str()); \
11 }
12 
13 namespace hmbdc {
15  : std::exception {
17  char const* what() const noexcept override {
18  return "Unknown excpetion";
19  }
20  };
21 
22  struct ExitCode
23  : std::exception {
24  explicit ExitCode(int c) {
25  sprintf(code, "%d", c);
26  }
27  char const* what() const noexcept override {
28  return code;
29  }
30 
31  private:
32  char code[16];
33  };
34 }
35 
Definition: Exception.hpp:14
Definition: Exception.hpp:22
Definition: Client.hpp:11