Skip to content

Commit

Permalink
Change id commitment not found status code from 400 to 404
Browse files Browse the repository at this point in the history
  • Loading branch information
mircobordoni committed Apr 26, 2024
1 parent 9160930 commit 7601573
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/server/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ impl Error {

let status_code = match self {
InvalidMethod => StatusCode::METHOD_NOT_ALLOWED,
InvalidPath => StatusCode::NOT_FOUND,
InvalidPath | IdentityCommitmentNotFound => StatusCode::NOT_FOUND,
InvalidContentType => StatusCode::UNSUPPORTED_MEDIA_TYPE,
IndexOutOfBounds
| RootTooOld
| IdentityCommitmentNotFound
| InvalidCommitment
| DuplicateCommitment
| InvalidSerialization(_) => StatusCode::BAD_REQUEST,
Expand All @@ -100,12 +99,11 @@ impl Error {
fn to_status_code(&self) -> StatusCode {
match self {
Self::InvalidMethod => StatusCode::METHOD_NOT_ALLOWED,
Self::InvalidPath => StatusCode::NOT_FOUND,
Self::InvalidPath | Self::IdentityCommitmentNotFound => StatusCode::NOT_FOUND,
Self::InvalidContentType => StatusCode::UNSUPPORTED_MEDIA_TYPE,
Self::IndexOutOfBounds
| Self::IdentityCommitmentNotFound
| Self::InvalidCommitment
| Self::InvalidSerialization(_) => StatusCode::BAD_REQUEST,
Self::IndexOutOfBounds | Self::InvalidCommitment | Self::InvalidSerialization(_) => {
StatusCode::BAD_REQUEST
}
Self::IdentityAlreadyDeleted
| Self::IdentityQueuedForDeletion
| Self::DuplicateCommitment => StatusCode::CONFLICT,
Expand Down

0 comments on commit 7601573

Please sign in to comment.