We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've not delved too deep into this yet, so I'm not sure how straight forward this would be to implement...
Having the ability to use exceptions to return an error response (and correct HTTP response code) would be extremely useful. A pseudo example:
Exception class:
class UnauthorizedException(ChaliceError): STATUS_CODE = 401
App logic:
if not authenticate(user): raise UnauthorizedException('You are not authenticated')
Response example (inc. correct response headers):
{"error": e.message}
Having quickly checked the source code, it looks like it should just be a cause of creating the exceptions and adding them to the ALL_ERRORS list.
ALL_ERRORS
Thoughts?
The text was updated successfully, but these errors were encountered:
I think that's a great idea.
Sorry, something went wrong.
Closing, implemented in #37
No branches or pull requests
I've not delved too deep into this yet, so I'm not sure how straight forward this would be to implement...
Having the ability to use exceptions to return an error response (and correct HTTP response code) would be extremely useful. A pseudo example:
Exception class:
App logic:
Response example (inc. correct response headers):
Having quickly checked the source code, it looks like it should just be a cause of creating the exceptions and adding them to the
ALL_ERRORS
list.Thoughts?
The text was updated successfully, but these errors were encountered: