rust_gmail/
error.rs

1/// Errors that may occur during any of the operations in this lib.
2#[derive(Debug, thiserror::Error)]
3pub enum GoogleApiError {
4    /// A tls error occurred.
5    #[error("OpenSSL error stack `{0}`")]
6    OpenSSLError(#[from] openssl::error::ErrorStack),
7    /// A jwt error occurred.
8    #[error("JWT error `{0}`")]
9    JwtError(#[from] jwt::Error),
10    /// Got an error whilst processing a request.
11    #[error("Reqwest error `{0}`")]
12    ReqwestError(#[from] reqwest::Error),
13    /// An error occurred whilst retrieving the access token.
14    #[error("Token retrieval error `{0}`")]
15    TokenRetrivalError(String),
16    /// An error occurred whilst sending the email.
17    #[error("Error sending email `{0}`")]
18    EmailSendError(String),
19    /// An IO error occurred.
20    #[error("Failed to load service account file `{0}`")]
21    ServiceAccountLoadFailure(std::io::Error),
22    /// A serialization error occurred
23    #[error("Serialization error `{0}`")]
24    SerdeError(#[from] serde_json::Error),
25}
26
27/// A `Result` alias with a `GoogleApiError` for the Err case.
28pub type Result<T> = std::result::Result<T, GoogleApiError>;