http_request_derive_client_reqwest/
reqwest_client_error.rs

1// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
2//
3// SPDX-License-Identifier: MIT OR Apache-2.0
4
5use snafu::Snafu;
6
7/// Errors that result from performing HTTP requests through the [`crate::ReqwestClient`].
8#[derive(Debug, Snafu)]
9#[snafu(visibility(pub(crate)))]
10pub enum ReqwestClientError {
11    /// The conversion from a [`http_request_derive::HttpRequest`] to a [`http::Request`] has failed.
12    #[snafu(display("Error converting http-request-derive HttpRequest to http Request"))]
13    ConvertToHttpRequest {
14        /// The source error
15        source: http_request_derive::Error,
16    },
17
18    /// The conversion from a [`http::Request`] to a [`reqwest::Request`] has failed.
19    #[snafu(display("Error converting http Request to reqwest Request"))]
20    ConvertToReqwestRequest {
21        /// The source error
22        source: reqwest::Error,
23    },
24
25    /// The request execution has failed.
26    #[snafu(display("Request execution error"))]
27    RequestExecution {
28        /// The source error
29        source: reqwest::Error,
30    },
31
32    /// Retrieval of the response body from the [`reqwest::Response`] has failed.
33    #[snafu(display("Failed to retrieve response body"))]
34    RetrieveResponseBody {
35        /// The source error
36        source: reqwest::Error,
37    },
38
39    /// Building the [`http::Response`] has failed.
40    #[snafu(display("Failed to store body from response into http Response"))]
41    BuildHttpResponseBody {
42        /// The source error
43        source: http::Error,
44    },
45
46    /// Reading the response from the [`http::Response`] has failed.
47    #[snafu(display("Failed to read the response for the specific request"))]
48    ReadResponse {
49        /// The source error
50        source: http_request_derive::Error,
51    },
52}