userver: userver/storages/mongo/exception.hpp Source File
Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1#pragma once
2
5
7
8USERVER_NAMESPACE_BEGIN
9
10namespace storages::mongo {
11
13class MongoException : public utils::TracefulException {
14public:
15 MongoException();
16
17 explicit MongoException(std::string_view what);
18};
19
21class InvalidConfigException : public MongoException {
22 using MongoException::MongoException;
23};
24
26class CancelledException : public MongoException {
27public:
28 struct ByDeadlinePropagation final {};
29
30 using MongoException::MongoException;
31
32 explicit CancelledException(ByDeadlinePropagation);
33
34 bool IsByDeadlinePropagation() const;
35
36private:
37 bool by_deadline_propagation_{false};
38};
39
41class PoolNotFoundException : public MongoException {
42 using MongoException::MongoException;
43};
44
46class PoolOverloadException : public MongoException {
47 using MongoException::MongoException;
48};
49
51class TransactionException : public MongoException {
52public:
58
59 TransactionException(Type type, std::string_view what);
60
61 Type GetType() const noexcept { return type_; }
62
63private:
64 Type type_;
65};
66
68class NetworkException : public MongoException {
69public:
70 using MongoException::MongoException;
71};
72
74class ClusterUnavailableException : public MongoException {
75public:
76 using MongoException::MongoException;
77};
78
80class IncompatibleServerException : public MongoException {
81public:
82 using MongoException::MongoException;
83};
84
86class AuthenticationException : public MongoException {
87public:
88 using MongoException::MongoException;
89};
90
92class QueryException : public MongoException {
93public:
94 using MongoException::MongoException;
95};
96
99public:
100 using QueryException::QueryException;
101};
102
104class ServerException : public QueryException {
105public:
106 explicit ServerException(int code)
107 : code_(code)
108 {}
109
110 int Code() const { return code_; }
111
112private:
113 int code_;
114};
115
117class WriteConcernException : public ServerException {
118public:
119 using ServerException::ServerException;
120};
121
123class DuplicateKeyException : public ServerException {
124public:
125 using ServerException::ServerException;
126};
127
128} // namespace storages::mongo
129
130USERVER_NAMESPACE_END