Skip to content

Commit

Permalink
web/error: add AxumNope::MissingAuthenticationToken
Browse files Browse the repository at this point in the history
  • Loading branch information
pflanze committed Jun 24, 2024
1 parent 041c702 commit 3ba2a0f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/web/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub enum AxumNope {
VersionNotFound,
#[error("Search yielded no results")]
NoResults,
#[error("Missing authentication token")]
MissingAuthenticationToken,
#[error("Invalid authentication token")]
InvalidAuthenticationToken,
#[error("internal error")]
Expand Down Expand Up @@ -95,6 +97,11 @@ impl AxumNope {
message: Cow::Owned(source.to_string()),
status: StatusCode::BAD_REQUEST,
}),
AxumNope::MissingAuthenticationToken => ErrorResponse::ErrorInfo(ErrorInfo {
title: "Missing authentication token",
message: "The token used for authentication is missing".into(),
status: StatusCode::UNAUTHORIZED,
}),
AxumNope::InvalidAuthenticationToken => ErrorResponse::ErrorInfo(ErrorInfo {
title: "Invalid authentication token",
message: "The token used for authentication is not valid".into(),
Expand Down

0 comments on commit 3ba2a0f

Please sign in to comment.