tauri_plugin_google_auth/
error.rs

1use serde::{ser::Serializer, Serialize};
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7  #[error(transparent)]
8  Io(#[from] std::io::Error),
9  #[cfg(mobile)]
10  #[error(transparent)]
11  PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError),
12  #[error("Authentication failed: {0}")]
13  AuthenticationFailed(String),
14  #[error("User cancelled the sign-in flow")]
15  UserCancelled,
16  #[error("No user is currently signed in")]
17  NoUserSignedIn,
18  #[error("Invalid client ID provided")]
19  InvalidClientId,
20  #[error("Token refresh failed: {0}")]
21  TokenRefreshFailed(String),
22  #[error("Network error: {0}")]
23  NetworkError(String),
24  #[error("Configuration error: {0}")]
25  ConfigurationError(String),
26}
27
28impl Serialize for Error {
29  fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30  where
31    S: Serializer,
32  {
33    serializer.serialize_str(self.to_string().as_ref())
34  }
35}