Skip to main content

flows_http/
error.rs

1// This is free and unencumbered software released into the public domain.
2
3use alloc::boxed::Box;
4use core::error::Error as StdError;
5use thiserror::Error;
6
7pub type Result<T = (), E = Error> = core::result::Result<T, E>;
8
9#[derive(Debug, Error)]
10pub enum Error {
11    #[error("missing URL scheme")]
12    MissingUrlScheme,
13
14    #[error("missing URL host")]
15    MissingUrlHost,
16
17    #[cfg(feature = "std")]
18    #[error("TCP connection failed: {0}")]
19    TcpConnectFailed(std::io::Error),
20
21    #[error("HTTP handshake failed: {0}")]
22    HttpHandshakeFailed(hyper::Error),
23
24    #[error("HTTP request failed: {0}")]
25    HttpRequestFailed(#[from] hyper::Error),
26
27    #[cfg(feature = "std")]
28    #[error("I/O failed: {0}")]
29    StdioFailed(#[from] std::io::Error),
30
31    #[error("unknown error: {0}")]
32    Other(#[from] Box<dyn StdError + Send + Sync>),
33}