Subordination
A framework for distributed programming
home
slurm-ci
jobs
subordination-subordination-17
src
subordination
base
error.hh
1
#ifndef SUBORDINATION_BASE_ERROR_HH
2
#define SUBORDINATION_BASE_ERROR_HH
3
4
#include <iosfwd>
5
#include <stdexcept>
6
7
namespace
sbn {
8
9
class
error
:
public
std::runtime_error
{
10
11
private
:
12
const
char
* _file =
"<unknown>"
;
13
int
_line = 0;
14
const
char
* _func =
"<unknown>"
;
15
16
public
:
17
inline
explicit
18
error
(
const
char
* msg) noexcept:
19
std::runtime_error
(msg)
20
{}
21
22
virtual
~
error
() noexcept =
default
;
23
24
inline
const
error
&
25
set_location(
const
char
* file,
int
line,
const
char
* func) noexcept {
26
this->_file = file;
27
this->_line = line;
28
this->_func = func;
29
return
*
this
;
30
}
31
32
friend
std::ostream
&
33
operator<<(
std::ostream
& out,
const
error
& rhs);
34
35
};
36
37
std::ostream
&
38
operator<<(
std::ostream
& out,
const
error
& rhs);
39
40
}
41
42
#define SUBORDINATION_THROW(error, ...) \
43
throw ::sbn::error(__VA_ARGS__).set_location(__FILE__,__LINE__,__func__)
44
45
#endif // vim:filetype=cpp
std::runtime_error
sbn::error
Definition:
error.hh:9
std::ostream
Generated by
1.8.15