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 {
22 public:
23 explicit YdbResponseError(std::string_view operation_name,
24 NYdb::TStatus&& status);
25
26 const NYdb::TStatus& GetStatus() const noexcept;
27
28 private:
29 NYdb::TStatus status_;
30};
31
32class UndefinedDatabaseError : public BaseError {
33 public:
34 explicit UndefinedDatabaseError(std::string error);
35};
36
37class EmptyResponseError : public BaseError {
38 public:
39 explicit EmptyResponseError(std::string_view expected);
40};
41
42class ParseError : public BaseError {
43 public:
44 explicit ParseError(std::string error);
45};
46
47class ColumnParseError : public ParseError {
48 public:
49 ColumnParseError(std::string_view column_name, std::string_view message);
50};
51
52class TypeMismatchError : public BaseError {
53 public:
54 TypeMismatchError(std::string_view name, std::string_view expected,
55 std::string_view actual);
56};
57
58class DeadlineExceededError : public BaseError {
59 public:
60 explicit DeadlineExceededError(std::string msg);
61};
62
64 public:
65 InvalidTransactionError();
66};
67
69 public:
70 OperationCancelledError();
71};
72
73class ResponseTruncatedError : public BaseError {
74 public:
75 ResponseTruncatedError();
76};
77
79 public:
80 TransactionForceRollback();
81};
82
83class IgnoreResultsError : public BaseError {
84 public:
85 IgnoreResultsError(std::string err);
86};
87
88} // namespace ydb
89
90USERVER_NAMESPACE_END