userver
C++ Async Framework
Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/mongo/exception.hpp
4
/// @brief MongoDB-specific exceptions
5
6
#
include
<
userver
/
utils
/
traceful_exception
.
hpp
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
storages
::mongo {
11
12
/// Generic mongo-related exception
13
class
MongoException
:
public
utils::
TracefulException
{
14
public
:
15
MongoException();
16
17
explicit
MongoException(std::string_view what);
18
};
19
20
/// Config validation error
21
class
InvalidConfigException
:
public
MongoException
{
22
using
MongoException
::MongoException;
23
};
24
25
/// The current task has been cancelled, e.g. by deadline propagation
26
class
CancelledException
:
public
MongoException
{
27
public
:
28
struct
ByDeadlinePropagation
final
{};
29
30
using
MongoException
::MongoException;
31
32
explicit
CancelledException(ByDeadlinePropagation);
33
34
bool
IsByDeadlinePropagation()
const
;
35
36
private
:
37
bool
by_deadline_propagation_{
false
};
38
};
39
40
/// Nonexistent pool requested from the set
41
class
PoolNotFoundException
:
public
MongoException
{
42
using
MongoException
::MongoException;
43
};
44
45
/// Pool refused to satisfy connection request due to high load
46
class
PoolOverloadException
:
public
MongoException
{
47
using
MongoException
::MongoException;
48
};
49
50
/// Network (connectivity) error
51
class
NetworkException
:
public
MongoException
{
52
public
:
53
using
MongoException
::MongoException;
54
};
55
56
/// No server available to satisfy request constraints
57
class
ClusterUnavailableException
:
public
MongoException
{
58
public
:
59
using
MongoException
::MongoException;
60
};
61
62
/// Incompatible server version
63
class
IncompatibleServerException
:
public
MongoException
{
64
public
:
65
using
MongoException
::MongoException;
66
};
67
68
/// Authentication error
69
class
AuthenticationException
:
public
MongoException
{
70
public
:
71
using
MongoException
::MongoException;
72
};
73
74
/// Generic query error
75
class
QueryException
:
public
MongoException
{
76
public
:
77
using
MongoException
::MongoException;
78
};
79
80
/// Query argument validation error
81
class
InvalidQueryArgumentException
:
public
QueryException
{
82
public
:
83
using
QueryException
::QueryException;
84
};
85
86
/// Server-side error
87
class
ServerException
:
public
QueryException
{
88
public
:
89
explicit
ServerException(
int
code) : code_(code) {}
90
91
int
Code()
const
{
return
code_; }
92
93
private
:
94
int
code_;
95
};
96
97
/// Write concern error
98
class
WriteConcernException
:
public
ServerException
{
99
public
:
100
using
ServerException
::ServerException;
101
};
102
103
/// Duplicate key error
104
class
DuplicateKeyException
:
public
ServerException
{
105
public
:
106
using
ServerException
::ServerException;
107
};
108
109
}
// namespace storages::mongo
110
111
USERVER_NAMESPACE_END
userver
storages
mongo
exception.hpp
Generated on Wed May 15 2024 22:34:46 for userver by
Doxygen
1.10.0