bhttp/
err.rs

1#[derive(thiserror::Error, Debug)]
2pub enum Error {
3    #[error("a request used the CONNECT method")]
4    ConnectUnsupported,
5    #[error("a field contained invalid Unicode: {0}")]
6    CharacterEncoding(#[from] std::string::FromUtf8Error),
7    #[error("read a response when expecting a request")]
8    ExpectedRequest,
9    #[error("read a request when expecting a response")]
10    ExpectedResponse,
11    #[error("a field contained an integer value that was out of range: {0}")]
12    IntRange(#[from] std::num::TryFromIntError),
13    #[error("the mode of the message was invalid")]
14    InvalidMode,
15    #[error("the status code of a response needs to be in 100..=599")]
16    InvalidStatus,
17    #[cfg(feature = "stream")]
18    #[error("a method was called when the message was in the wrong state")]
19    InvalidState,
20    #[error("IO error {0}")]
21    Io(#[from] std::io::Error),
22    #[cfg(feature = "stream")]
23    #[error("the size of a vector exceeded the limit that was set")]
24    LimitExceeded,
25    #[error("a field or line was missing a necessary character 0x{0:x}")]
26    Missing(u8),
27    #[error("a URL was missing a key component")]
28    MissingUrlComponent,
29    #[error("an obs-fold line was the first line of a field section")]
30    ObsFold,
31    #[error("a field contained a non-integer value: {0}")]
32    ParseInt(#[from] std::num::ParseIntError),
33    #[error("a field was truncated")]
34    Truncated,
35    #[error("a message included the Upgrade field")]
36    UpgradeUnsupported,
37    #[error("a URL could not be parsed into components: {0}")]
38    #[cfg(feature = "http")]
39    UrlParse(#[from] url::ParseError),
40}
41
42pub type Res<T> = Result<T, Error>;