Skip to main content

better_auth_allsource/
error.rs

1use better_auth_core::error::{AuthError, DatabaseError};
2
3#[derive(Debug, thiserror::Error)]
4pub enum AllsourceAuthError {
5    #[error("HTTP request failed: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("JSON serialization error: {0}")]
9    Json(#[from] serde_json::Error),
10
11    #[error("Allsource API error ({status}): {message}")]
12    Api { status: u16, message: String },
13}
14
15impl From<AllsourceAuthError> for AuthError {
16    fn from(err: AllsourceAuthError) -> Self {
17        AuthError::Database(DatabaseError::Query(err.to_string()))
18    }
19}