http/
error.rs

1//! # Error
2//!
3//! Module dedicated to keyring errors. It contains an [`Error`] enum
4//! based on [`thiserror::Error`] and a type alias [`Result`].
5
6use thiserror::Error;
7use ureq::http::Uri;
8
9/// The global `Result` alias of the library.
10pub type Result<T> = std::result::Result<T, Error>;
11
12/// The global `Error` enum of the library.
13#[derive(Debug, Error)]
14pub enum Error {
15    #[error("error while sending request to {1}")]
16    SendBodyError(#[source] ureq::http::Error, Uri),
17    #[error("error while sending GET request to {1}")]
18    SendGetRequestError(#[source] ureq::Error, Uri),
19    #[error("error while sending POST request to {1}")]
20    SendPostRequestError(#[source] ureq::Error, Uri),
21    #[error("error while sending request")]
22    SendRequestError(#[source] ureq::Error),
23
24    #[error(transparent)]
25    UreqError(#[from] ureq::Error),
26    #[error(transparent)]
27    HttpError(#[from] ureq::http::Error),
28    #[error(transparent)]
29    UriError(#[from] ureq::http::uri::InvalidUri),
30    #[cfg(feature = "tokio")]
31    #[error(transparent)]
32    JoinError(#[from] tokio::task::JoinError),
33}