hmbdc
simplify-high-performance-messaging-programming
Main Page
Namespaces
Classes
Files
Examples
File List
hmbdc
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
{
14
/**
15
* @brief Unknown excpetion
16
*/
17
struct
UnknownException
18
: std::exception {
19
UnknownException
(){}
20
char
const
* what()
const
noexcept
override
{
21
return
"Unknown excpetion"
;
22
}
23
};
24
25
/**
26
* @brief Exception that just has an exit code
27
*/
28
struct
ExitCode
29
: std::exception {
30
explicit
ExitCode
(
int
c) {
31
sprintf(code,
"%d"
, c);
32
}
33
char
const
* what()
const
noexcept
override
{
34
return
code;
35
}
36
37
private
:
38
char
code[16];
39
};
40
}
41
hmbdc::UnknownException
Unknown excpetion.
Definition:
Exception.hpp:17
hmbdc::ExitCode
Exception that just has an exit code.
Definition:
Exception.hpp:28
hmbdc
Definition:
Base.hpp:12
Generated by
1.8.11