#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("curl error: {0}")]
Curl(#[from] curl::Error),
#[error("curl multi error: {0}")]
CurlMulti(#[from] curl::MultiError),
#[error("invalid header name: {0}")]
InvalidHeaderName(#[from] http::header::InvalidHeaderName),
#[error("invalid header value: {0}")]
InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),
#[error("invalid status code: {0}")]
InvalidStatusCode(#[from] http::status::InvalidStatusCode),
#[error("header value is not visible ASCII: {0}")]
HeaderToStr(#[from] http::header::ToStrError),
#[error("header parse error: {0}")]
HeaderParse(String),
#[error("MIME parse error: {0}")]
Mime(#[from] mime::FromStrError),
#[error("multipart parse error: {0}")]
Multipart(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("too many redirects (more than {0})")]
TooManyRedirects(u32),
#[error("body is not valid UTF-8: {0}")]
Utf8(#[from] std::str::Utf8Error),
#[error("HTTP {}", .0.status())]
Status(Box<crate::Response>),
#[error("unsupported URL scheme: {0}")]
UnsupportedScheme(String),
#[error("response body larger than {0} bytes")]
BodyTooLarge(u64),
#[cfg(feature = "json")]
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
}
impl From<std::convert::Infallible> for Error {
fn from(never: std::convert::Infallible) -> Self {
match never {}
}
}
pub type Result<T, E = Error> = std::result::Result<T, E>;