Toolbox
snapshot
The Reactive C++ Toolbox
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
z
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
z
Variables
Typedefs
a
b
c
d
e
f
h
i
j
l
m
n
p
r
s
t
u
w
Enumerations
Enumerator
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
h
i
l
m
n
o
p
r
s
t
u
v
w
Typedefs
a
c
d
e
f
i
p
r
s
t
v
Enumerations
Enumerator
Related Symbols
b
i
o
t
Files
File List
File Members
All
a
b
h
i
l
m
o
s
t
x
Functions
a
b
m
o
Variables
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
toolbox
util
Exception.cpp
Go to the documentation of this file.
1
// The Reactive C++ Toolbox.
2
// Copyright (C) 2013-2019 Swirly Cloud Limited
3
// Copyright (C) 2021 Reactive Markets Limited
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
17
#include "
Exception.hpp
"
18
19
namespace
toolbox
{
20
inline
namespace
util {
21
using namespace
std
;
22
namespace
{
23
thread_local
ErrMsg
err_msg_
;
24
}
// namespace
25
26
Exception::Exception
(error_code
ec
)
27
: runtime_error{
ec
.
message
()}
28
, ec_{
ec
}
29
{
30
}
26
Exception::Exception
(error_code
ec
) {
…
}
31
32
Exception::Exception
(
int
err
,
const
error_category&
ecat
)
33
:
Exception
{error_code{
err
,
ecat
}}
34
{
35
}
32
Exception::Exception
(
int
err
,
const
error_category&
ecat
) {
…
}
36
37
Exception::Exception
(error_code
ec
, std::string_view
what
)
38
: runtime_error{string{
what
}}
39
, ec_{
ec
}
40
{
41
}
37
Exception::Exception
(error_code
ec
, std::string_view
what
) {
…
}
42
43
Exception::Exception
(
int
err
,
const
error_category&
ecat
, std::string_view
what
)
44
:
Exception
{error_code{
err
,
ecat
},
what
}
45
{
46
}
43
Exception::Exception
(
int
err
,
const
error_category&
ecat
, std::string_view
what
) {
…
}
47
48
Exception::~Exception
() =
default
;
49
50
void
Exception::to_json
(ostream& os,
int
code,
const
char
*
message
)
51
{
52
os <<
"{\"code\":"
<<
code
//
53
<<
",\"message\":\""
<<
message
//
54
<<
"\"}"
;
55
}
50
void
Exception::to_json
(ostream& os,
int
code,
const
char
*
message
) {
…
}
56
57
ErrMsg
&
err_msg
()
noexcept
58
{
59
err_msg_
.
os_
.
reset
();
60
return
err_msg_
;
61
}
57
ErrMsg
&
err_msg
()
noexcept
{
…
}
62
63
}
// namespace util
64
}
// namespace toolbox
toolbox::util::Exception
Definition
Exception.hpp:45
toolbox::util::Exception::code
const std::error_code & code() const noexcept
Returns the error code.
Definition
Exception.hpp:81
toolbox::util::Exception::to_json
static void to_json(std::ostream &os, int code, const char *message)
Definition
Exception.cpp:50
toolbox::util::Exception::Exception
Exception(std::error_code ec=std::error_code())
Definition
Exception.cpp:26
toolbox::util::Exception::~Exception
~Exception() override
toolbox::util::OStaticStream::reset
void reset() noexcept
Reset the current position back to the beginning of the buffer.
Definition
Stream.hpp:172
std
STL namespace.
toolbox::util::err_msg
ErrMsg & err_msg() noexcept
Definition
Exception.cpp:57
toolbox::util::bind
constexpr auto bind() noexcept
Definition
Slot.hpp:97
toolbox
Definition
Benchmark.cpp:26
toolbox::ErrMsg
Definition
Exception.hpp:31
toolbox::util::ErrMsg::os_
OStaticStream< MaxErrSize > os_
Definition
Exception.hpp:32
Exception.hpp
Generated by
1.9.8