clickhouse_client/
error.rs1#[derive(Debug, thiserror::Error)]
5#[error("{0}")]
6pub struct Error(pub String);
7
8impl Error {
9 pub fn new(msg: &str) -> Self {
11 Self(msg.to_string())
12 }
13
14 pub fn message(&self) -> &str {
16 &self.0
17 }
18}
19
20impl From<hyper::http::Error> for Error {
21 fn from(value: hyper::http::Error) -> Self {
22 Error(value.to_string())
23 }
24}
25
26impl From<hyper::http::uri::InvalidUriParts> for Error {
27 fn from(value: hyper::http::uri::InvalidUriParts) -> Self {
28 Error(value.to_string())
29 }
30}
31
32impl From<hyper::http::uri::InvalidUri> for Error {
33 fn from(value: hyper::http::uri::InvalidUri) -> Self {
34 Error(value.to_string())
35 }
36}
37
38impl From<hyper::Error> for Error {
39 fn from(value: hyper::Error) -> Self {
40 Error(value.to_string())
41 }
42}
43
44impl From<std::string::FromUtf8Error> for Error {
45 fn from(value: std::string::FromUtf8Error) -> Self {
46 Error(value.to_string())
47 }
48}
49
50impl From<leb128::read::Error> for Error {
51 fn from(value: leb128::read::Error) -> Self {
52 Error(value.to_string())
53 }
54}
55
56impl From<std::io::Error> for Error {
57 fn from(value: std::io::Error) -> Self {
58 Error(value.to_string())
59 }
60}
61
62impl From<std::num::TryFromIntError> for Error {
63 fn from(value: std::num::TryFromIntError) -> Self {
64 Error(value.to_string())
65 }
66}
67
68impl From<std::num::ParseIntError> for Error {
69 fn from(value: std::num::ParseIntError) -> Self {
70 Error(value.to_string())
71 }
72}
73
74impl From<std::num::ParseFloatError> for Error {
75 fn from(value: std::num::ParseFloatError) -> Self {
76 Error(value.to_string())
77 }
78}
79
80impl From<std::str::ParseBoolError> for Error {
81 fn from(value: std::str::ParseBoolError) -> Self {
82 Error(value.to_string())
83 }
84}
85
86impl From<uuid::Error> for Error {
87 fn from(value: uuid::Error) -> Self {
88 Error(value.to_string())
89 }
90}
91
92impl From<time::error::Parse> for Error {
93 fn from(value: time::error::Parse) -> Self {
94 Error(value.to_string())
95 }
96}
97
98impl From<time::error::ComponentRange> for Error {
99 fn from(value: time::error::ComponentRange) -> Self {
100 Error(value.to_string())
101 }
102}
103
104impl From<std::array::TryFromSliceError> for Error {
105 fn from(value: std::array::TryFromSliceError) -> Self {
106 Error(value.to_string())
107 }
108}