Consider making it easier to construct ErrorResponse from a non-IntoResponse error #2671
Labels
A-axum
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
I-needs-decision
Issues in need of decision.
Feature Request
Motivation
People ask about short-circuiting from handler functions with non-
IntoResponse
errors somewhat frequently.We already have
ErrorResponse
inaxum::response
for returning different error types from a handler function conveniently. However, right now it is quite annoying to construct one from a non-IntoResponse
error type (see alternatives).Proposal
Add
to allow users to write
Alternatives
Expose a free function, same thing but less verbose
Do nothing. One can already do
Open questions
Should the
internal_server_error
function log the error as well?The text was updated successfully, but these errors were encountered: