1use std::num::ParseIntError;
2use thiserror::Error;
3use url::Url;
4
5#[derive(Error, Debug)]
9#[non_exhaustive]
10pub enum RsdbcErrors {
11 #[error("Configuration error: `{0}`")]
12 Configuration(String),
13
14 #[error("General error: `{0}`")]
15 General(String),
16
17 #[error("Unsupported error: `{0}`")]
18 Unsupported(String),
19
20 #[error("URL parse error: `{0}`")]
21 UrlParseError(#[from] url::ParseError),
22
23 #[error("Int parse error: `{0}`")]
24 ParseIntError(#[from] ParseIntError),
25
26 #[error("Unknown Database")]
27 UnknownDatabase,
28}
29
30impl RsdbcErrors {
31
32 #[allow(dead_code)]
39 #[inline]
40 pub fn config(err: String) -> Self {
41 RsdbcErrors::Configuration(err)
42 }
43}
44
45#[derive(Debug)]
46#[non_exhaustive]
47pub enum RsdbcError {
48 BadGrammar,
49 General,
50 NonTransient,
51 NonTransientResource,
52 PermissionDenied,
53 Rollback,
54 Timeout,
55 Transient,
56 TransientResource
57}
58
59