10#include <fmt/format.h>
12#include <userver/storages/postgres/dsn.hpp>
13#include <userver/storages/postgres/io/traits.hpp>
14#include <userver/storages/postgres/message.hpp>
16#include <userver/compiler/demangle.hpp>
17#include <userver/utils/underlying_value.hpp>
19USERVER_NAMESPACE_BEGIN
27std::string OidPrettyPrint(Oid oid);
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
178class Error :
public std::runtime_error {
179 using runtime_error::runtime_error;
201template <
typename Base>
204 explicit ServerError(
const Message& msg)
205 : Base(msg.GetMessage()),
209 const Message& GetServerMessage()
const {
return msg_; }
211 Message::Severity GetSeverity()
const {
return msg_.GetSeverity(); }
212 SqlState GetSqlState()
const {
return msg_.GetSqlState(); }
231 explicit ConnectionFailed(
const Dsn& dsn);
232 ConnectionFailed(
const Dsn& dsn, std::string_view message);
245 PoolError(std::string_view msg, std::string_view db_name);
246 PoolError(std::string_view msg);
287 using ServerLogicError::ServerLogicError;
294 using ServerRuntimeError::ServerRuntimeError;
301 using ServerLogicError::ServerLogicError;
308 using ServerRuntimeError::ServerRuntimeError;
315 using ServerRuntimeError::ServerRuntimeError;
322 using ServerLogicError::ServerLogicError;
329 using ServerRuntimeError::ServerRuntimeError;
336 using ServerLogicError::ServerLogicError;
345 using ServerRuntimeError::ServerRuntimeError;
356 using ServerRuntimeError::ServerRuntimeError;
358 std::string GetSchema()
const;
359 std::string GetTable()
const;
360 std::string GetConstraint()
const;
401 using ServerRuntimeError::ServerRuntimeError;
408 using ServerRuntimeError::ServerRuntimeError;
416 using ServerRuntimeError::ServerRuntimeError;
429 using ServerLogicError::ServerLogicError;
436 using ServerLogicError::ServerLogicError;
443 using ServerRuntimeError::ServerRuntimeError;
450 using ServerRuntimeError::ServerRuntimeError;
457 using ServerRuntimeError::ServerRuntimeError;
464 using ServerRuntimeError::ServerRuntimeError;
471 using ServerRuntimeError::ServerRuntimeError;
478 using ServerRuntimeError::ServerRuntimeError;
485 using ServerRuntimeError::ServerRuntimeError;
492 using ServerLogicError::ServerLogicError;
496 using ServerLogicError::ServerLogicError;
500 using ServerLogicError::ServerLogicError;
508 using ServerRuntimeError::ServerRuntimeError;
515 using ServerRuntimeError::ServerRuntimeError;
522 using ServerRuntimeError::ServerRuntimeError;
529 using ServerRuntimeError::ServerRuntimeError;
556 using ServerRuntimeError::ServerRuntimeError;
563 using ServerRuntimeError::ServerRuntimeError;
570 using ServerRuntimeError::ServerRuntimeError;
577 using ServerRuntimeError::ServerRuntimeError;
584 using ServerRuntimeError::ServerRuntimeError;
591 using ServerRuntimeError::ServerRuntimeError;
604 AlreadyInTransaction();
610 NotInTransaction(
const std::string& msg);
615 TransactionForceRollback();
616 TransactionForceRollback(
const std::string& msg);
626 ResultSetError(std::string msg);
628 void AddMsgSuffix(std::string_view str);
629 void AddMsgPrefix(std::string_view str);
631 const char* what()
const noexcept override;
640 RowIndexOutOfBounds(std::size_t index);
646 FieldIndexOutOfBounds(std::size_t index);
652 FieldNameDoesntExist(std::string_view name);
659 template <
typename T>
660 FieldValueIsNull(std::size_t field_index, std::string_view field_name,
const T&)
662 "Field #{} name `{}` C++ type `{}` value is null, forgot `std::optional`?",
675 TypeCannotBeNull(std::string_view type);
691 UnknownBufferCategory(std::string_view context, Oid type_oid);
692 UnknownBufferCategory(Oid type_oid, std::string_view cpp_field_type, std::string_view cpp_composite_type);
712 InvalidBinaryBuffer(
const std::string& message);
719 InvalidTupleSizeRequested(std::size_t field_count, std::size_t tuple_size);
726 NonSingleColumnResultSet(std::size_t actual_size, std::string_view type_name, std::string_view func);
732 explicit NonSingleRowResultSet(std::size_t actual_size);
739 FieldTupleMismatch(std::size_t field_count, std::size_t tuple_size);
761 CompositeSizeMismatch(std::size_t pg_size, std::size_t cpp_size, std::string_view cpp_type);
768 CompositeMemberTypeMismatch(
769 std::string_view pg_type_schema,
770 std::string_view pg_type_name,
771 std::string_view field_name,
795 InvalidDimensions(std::size_t expected, std::size_t actual);
839 InvalidEnumerationLiteral(std::string_view type_name, std::string_view literal);
844 template <
typename Enum>
845 explicit InvalidEnumerationValue(Enum val)
847 "Invalid enumeration value '{}' for enum type '{}'",
848 USERVER_NAMESPACE::utils::UnderlyingValue(val),
859 UnsupportedInterval();
865 BoundedRangeError(std::string_view message);
880 BitStringOverflow(std::size_t actual, std::size_t expected);
886 InvalidBitStringRepresentation();
894 InvalidDSN(std::string_view dsn, std::string_view err);
916 explicit IpAddressInvalidFormat(std::string_view str);