Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
b
c
d
e
h
i
l
m
n
p
r
s
u
x
Typedefs
b
c
d
e
f
g
i
m
p
r
u
v
Enumerations
Enumerator
a
b
f
g
i
m
n
r
s
u
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
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
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
m
n
p
q
r
s
t
u
v
x
Enumerations
a
c
d
e
f
k
l
m
p
r
s
t
v
w
Enumerator
a
b
d
f
g
h
i
l
m
n
o
p
r
s
u
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
b
c
d
e
f
g
m
o
p
r
s
t
u
v
w
Variables
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
w
Typedefs
Enumerations
Enumerator
Macros
_
d
f
i
m
n
p
s
t
u
shared
depthai-shared
3rdparty
nanorpc
core
exception.h
Go to the documentation of this file.
1
//-------------------------------------------------------------------
2
// Nano RPC
3
// https://github.com/tdv/nanorpc
4
// Created: 05.2018
5
// Copyright (C) 2018 tdv
6
//-------------------------------------------------------------------
7
8
#ifndef __NANO_RPC_CORE_EXCEPTION_H__
9
#define __NANO_RPC_CORE_EXCEPTION_H__
10
11
// STD
12
#include <iostream>
13
#include <stdexcept>
14
#include <string>
15
16
#define NANORPC_EXCEPTION_DECL(class_, base_) \
17
class class_ \
18
: public base_ \
19
{ \
20
public: \
21
using base_type = base_; \
22
using base_type :: base_type; \
23
};
24
25
#define NANORPC_EXCEPTION_DECL_WITH_NAMESPACE(namespace_, class_, base_) \
26
namespace namespace_ \
27
{ \
28
NANORPC_EXCEPTION_DECL(class_, base_) \
29
}
30
31
namespace
nanorpc
32
{
33
namespace
core
34
{
35
namespace
exception
36
{
37
38
39
NANORPC_EXCEPTION_DECL
(
nanorpc
, std::runtime_error)
40
NANORPC_EXCEPTION_DECL
(packer,
nanorpc
)
41
NANORPC_EXCEPTION_DECL
(logic,
nanorpc
)
42
NANORPC_EXCEPTION_DECL
(transport,
nanorpc
)
43
NANORPC_EXCEPTION_DECL
(
client
, transport)
44
NANORPC_EXCEPTION_DECL
(
server
, transport)
45
46
inline
std
::
string
to_string
(
std
::exception const &e)
47
{
48
std::string message = e.what();
49
50
try
51
{
52
std::rethrow_if_nested(e);
53
}
54
catch
(std::exception
const
&ex)
55
{
56
message +=
"\n"
;
57
message +=
"\t"
;
58
message +=
to_string
(ex);
59
}
60
61
return
message;
62
}
63
64
inline
void
default_error_handler
(std::exception_ptr e)
65
{
66
if
(!e)
67
return
;
68
69
try
70
{
71
std::rethrow_exception(e);
72
}
73
catch
(std::exception
const
&ex)
74
{
75
std::cerr <<
"NanoRPC exception message: "
<<
to_string
(ex) << std::endl;
76
}
77
}
78
79
80
}
// namespace exception
81
}
// namespace core
82
}
// namespace nanorpc
83
84
85
#endif // !__NANO_RPC_CORE_EXCEPTION_H__
nanorpc
Definition:
client.h:30
nanorpc::core::server
Definition:
server.h:40
nanorpc::core::exception::to_string
std::string to_string(std::exception const &e)
Definition:
exception.h:46
nanorpc::core::exception::default_error_handler
void default_error_handler(std::exception_ptr e)
Definition:
exception.h:64
std
Definition:
Node.hpp:366
nanorpc::core::client
Definition:
client.h:36
NANORPC_EXCEPTION_DECL
#define NANORPC_EXCEPTION_DECL(class_, base_)
Definition:
exception.h:16
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19