Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make internal server error new fallback error type #1092

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

georgeboot
Copy link

@georgeboot georgeboot commented Dec 18, 2024

Currently, all errors become a 400 Bad Request, unless an explicit error type is set. This is not ideal, as a bad request should not be retried by a client since it's the client that is at fault (as is for al 4xx codes). A better generic 'fallback' error would be a 500 internal server error, as it indicates something went wrong, and sending another attempt might very well succeed.

This pull requests changes the currenty behaviour by returning a 500 on all non-explicit errors.

Comment on lines +227 to +230
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
ErrorDetail::new("internal_server_error", "Internal Server Error"),
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have an InternalServer enum in this match. Replace the INTERNAL_SERVER_ERROR variant with InternalServerError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants