forked from ClickHouse/clickhouse-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.h
66 lines (50 loc) · 1.31 KB
/
exceptions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
#pragma once
#include "server_exception.h"
#include <stdexcept>
namespace clickhouse {
class Error : public std::runtime_error {
using std::runtime_error::runtime_error;
};
// Caused by any user-related code, like invalid column types or arguments passed to any method.
class ValidationError : public Error {
using Error::Error;
};
// Buffers+IO errors, failure to serialize/deserialize, checksum mismatches, etc.
class ProtocolError : public Error {
using Error::Error;
};
class UnimplementedError : public Error {
using Error::Error;
};
// Internal validation error.
class AssertionError : public Error {
using Error::Error;
};
class OpenSSLError : public Error {
using Error::Error;
};
class LZ4Error : public Error {
using Error::Error;
};
// Exception received from server.
class ServerException : public Error {
public:
ServerException(std::unique_ptr<Exception> e)
: Error(std::string())
, exception_(std::move(e))
{
}
int GetCode() const {
return exception_->code;
}
const Exception& GetException() const {
return *exception_;
}
const char* what() const noexcept override {
return exception_->display_text.c_str();
}
private:
std::unique_ptr<Exception> exception_;
};
using ServerError = ServerException;
}