Skip to main content

fcm_rs/
error.rs

1//! Error types for FCM operations.
2use crate::models::FcmErrorResponse;
3use thiserror::Error;
4
5/// Represents errors that can occur while using the FCM client.
6#[derive(Error, Debug)]
7pub enum FcmError {
8    /// An error occurred during an HTTP request.
9    #[error("Request failed: {0}")]
10    RequestError(#[from] reqwest::Error),
11
12    /// An error occurred during authentication.
13    #[error("Authentication failed: {0}")]
14    AuthError(String),
15
16    /// An error occurred during JSON serialization or deserialization.
17    #[error("JSON serialization/deserialization failed: {0}")]
18    JsonError(#[from] serde_json::Error),
19
20    /// An error occurred related to OAuth2.
21    #[error("OAuth2 error: {0}")]
22    OAuth2Error(#[from] yup_oauth2::Error),
23
24    /// An error occurred during file I/O operations.
25    #[error("IO error: {0}")]
26    IoError(#[from] std::io::Error),
27
28    // An error in the response from FCM.
29    #[error("Response error: {0}")]
30    ResponseError(FcmErrorResponse),
31}