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
use std::fmt;
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
pub type Result<T> = std::result::Result<T, BoxError>;
#[derive(Debug, Default, Copy, Clone)]
pub struct BadVersion;
impl fmt::Display for BadVersion {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Unknown HTTP version")
}
}
impl std::error::Error for BadVersion {}
#[derive(Debug, Default, Copy, Clone)]
pub struct BadHeader;
impl fmt::Display for BadHeader {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Error parsing header value")
}
}
impl std::error::Error for BadHeader {}