summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/error.rs b/src/error.rs
index 6414a13..16e341f 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,5 +1,4 @@
-use axum::{http::StatusCode, Json};
-use serde_json::json;
+use axum::http::StatusCode;
pub type Result<T, E = Error> = std::result::Result<T, E>;
@@ -26,6 +25,9 @@ pub enum Error {
#[error("Json error: {0}")]
Json(#[from] serde_json::Error),
+ #[error("Time error: {0}")]
+ Time(#[from] time::error::ComponentRange),
+
#[error("JSON web token error: {0}")]
Jwt(#[from] jsonwebtoken::errors::Error),
@@ -78,14 +80,7 @@ impl axum::response::IntoResponse for Error {
_ => StatusCode::INTERNAL_SERVER_ERROR,
};
- (
- status,
- Json(json!({
- "status": status.to_string(),
- "detail": self.to_string(),
- })),
- )
- .into_response()
+ (status, self.to_string()).into_response()
}
}
@@ -103,8 +98,8 @@ pub enum AuthError {
#[error("Invalid authorization token")]
JwtValidation(#[from] jsonwebtoken::errors::Error),
- #[error("Jwk not found")]
- JwkNotFound,
+ #[error("Invalid refresh token")]
+ RefreshTokenNotFound,
}
impl axum::response::IntoResponse for AuthError {