userver: userver/ydb/exceptions.hpp Source File
Loading...
Searching...
No Matches
exceptions.hpp
1#pragma once
2
3#include <ydb-cpp-sdk/client/types/status/status.h>
4
5#include <stdexcept>
6#include <string>
7#include <string_view>
8
9namespace NYdb {
10class TStatus;
11} // namespace NYdb
12
13USERVER_NAMESPACE_BEGIN
14
15namespace ydb {
16
17class BaseError : public std::runtime_error {
18 using std::runtime_error::runtime_error;
19};
20
21class YdbResponseError : public BaseError {
22public:
23 explicit YdbResponseError(std::string_view operation_name, NYdb::TStatus&& status);
24
25 const NYdb::TStatus& GetStatus() const noexcept;
26
27private:
28 NYdb::TStatus status_;
29};
30
31class UndefinedDatabaseError : public BaseError {
32public:
33 explicit UndefinedDatabaseError(std::string error);
34};
35
36class EmptyResponseError : public BaseError {
37public:
38 explicit EmptyResponseError(std::string_view expected);
39};
40
41class ParseError : public BaseError {
42public:
43 explicit ParseError(std::string error);
44};
45
46class ColumnParseError : public ParseError {
47public:
48 ColumnParseError(std::string_view column_name, std::string_view message);
49};
50
51class TypeMismatchError : public BaseError {
52public:
53 TypeMismatchError(std::string_view name, std::string_view expected, std::string_view actual);
54};
55
56class DeadlineExceededError : public BaseError {
57public:
58 explicit DeadlineExceededError(std::string msg);
59};
60
62public:
63 InvalidTransactionError();
64};
65
67public:
68 OperationCancelledError();
69};
70
71class ResponseTruncatedError : public BaseError {
72public:
73 ResponseTruncatedError();
74};
75
77public:
78 TransactionForceRollback();
79};
80
81class IgnoreResultsError : public BaseError {
82public:
83 IgnoreResultsError(std::string err);
84};
85
86} // namespace ydb
87
88USERVER_NAMESPACE_END