Debian Codegraph @

third_party/rust/bhttp/src/err.rs

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