parco_lob/create_postcard/
error.rs

1use thiserror::Error;
2
3use crate::ApiError;
4
5/// Errors that can occur while performing a Lob "create postcard" request.
6#[derive(Debug, Error)]
7pub enum CreatePostcardError {
8    /// HTTP or network error from [`reqwest`].
9    #[error("Reqwest: {0}")]
10    Reqwest(
11        #[from]
12        #[source]
13        reqwest::Error,
14    ),
15
16    /// Failed to serialize the json request
17    #[error("Json: {0}")]
18    Serialize(
19        #[from]
20        #[source]
21        serde_json::Error,
22    ),
23
24    /// An Api Error From Lob
25    #[error("Lob: {0}")]
26    Api(
27        #[from]
28        #[source]
29        ApiError,
30    ),
31
32    /// Failed to parse the JSON response.
33    ///
34    /// Contains the parse error and the raw response body.
35    #[error("Json: {0} - {1}")]
36    Json(#[source] serde_json::Error, String),
37}