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
#![cfg_attr(feature = "cargo-clippy", allow(stutter))]
use std;
use std::fmt::{self, Display};
#[allow(missing_copy_implementations)]
#[cfg_attr(feature = "cargo-clippy", allow(empty_enum))]
#[derive(Debug)]
pub enum BuildError {}
impl Display for BuildError {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {}
}
}
impl std::error::Error for BuildError {}
#[derive(Debug)]
pub enum RequestError {
Handler(Box<dyn std::error::Error + Send + Sync>),
Hyper(hyper::Error),
De(serde_json::Error),
Ser(serde_json::Error),
}
impl Display for RequestError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
RequestError::Handler(e) => e.fmt(f),
RequestError::Hyper(e) => e.fmt(f),
RequestError::De(e) | RequestError::Ser(e) => e.fmt(f),
}
}
}
impl std::error::Error for RequestError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
RequestError::Handler(_) => None,
RequestError::Hyper(e) => Some(e),
RequestError::De(e) | RequestError::Ser(e) => Some(e),
}
}
}