Skip to main content

smbcloud_email_sdk/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum EmailError {
5    /// The HTTP layer failed before we got a response — network down, DNS
6    /// failure, TLS handshake, that sort of thing.
7    #[error("request failed: {0}")]
8    Http(#[from] reqwest::Error),
9
10    /// The API replied with a non-2xx status. `message` is whatever the server
11    /// put in the response body (typically `{ "message": "..." }`), or the HTTP
12    /// reason phrase if the body wasn't readable.
13    #[error("email API error {status}: {message}")]
14    Api { status: u16, message: String },
15}