paystack/http/
errors.rs

1use thiserror::Error;
2
3/// An error enum to hold errors from reqwest client
4#[derive(Error, Debug)]
5pub enum ReqwestError {
6    /// Default HTTP error from the Reqwest crate.
7    /// This happens when the request cannot be completed.
8    #[error("request: {0}")]
9    Reqwest(#[from] reqwest::Error),
10
11    /// The initial request was successful, but the status code is in the 400
12    /// and 500 range. This signifies that API cannot handle the request sent,
13    /// We are only interested in the status code of this error
14    #[error("status code: {}", reqwest::Response::status(.0))]
15    StatusCode(reqwest::Response),
16}