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

Allow request guards to customize error responses #596

Closed
pjenvey opened this issue Apr 4, 2018 · 2 comments
Closed

Allow request guards to customize error responses #596

pjenvey opened this issue Apr 4, 2018 · 2 comments
Labels
enhancement A minor feature request

Comments

@pjenvey
Copy link

pjenvey commented Apr 4, 2018

Request guards lack the ability to customize error Responses on Failures other than setting a Status code. Error catchers can further customize error responses afterwards but they lack the context of the original error that occurred, which could be important for the response.

E.g. a request guard fails to validate some input and wants to render a JSON response including an accompanying error message.

It seems the only way to handle this is to defer to the Handler (having it take a Result<> from the guard). It would be much more convenient if a Responder could some how be passed along to Failure cases.

@SergioBenitez
Copy link
Member

Yes, this is absolutely a sore point. I've been working on a revamped error management design that will alleviate the issue. When it's ready, I'll post an issue describing it.

@SergioBenitez
Copy link
Member

Let's track this in #749.

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

No branches or pull requests

2 participants