Several of the HTTPError subclasses had incorrect or malformed docstrings; these were fixed and type annotations were added in support of sphinx.
864 B
864 B
Error Handling
When something goes horribly (or mildly) wrong, you could
manually set the error status, appropriate response headers, and even an
error body using the resp object. However, Falcon tries to
make things a bit easier by providing a set of exceptions you can raise
when something goes wrong. In fact, if Falcon catches any exception your
responder throws that inherits from falcon.HTTPError, the
framework will convert that exception to an appropriate HTTP error
response.
You may raise an instance of falcon.HTTPError directly,
or use any one of a number of predefined error classes that try to be
idiomatic in setting appropriate headers and bodies.
Base Class
falcon.HTTPError
Predefined Errors
falcon.exceptions