Files
deb-python-falcon/doc/api/errors.rst
Kurt Griffiths 14a82b5298 feat(falcon.exceptions): Improve HTTPInvalid* and HTTPMissing*
This patch cleans up HTTPInvalidHeader and HTTPInvalidParam, and adds
two additional, distinct classes to use when the header or param is
missing altogether.
2014-10-20 17:47:02 -05:00

1.3 KiB

Error Handling

When a request results in an error condition, 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 and more consistent by providing a set of error classes you can raise from within your app. Falcon catches any exception that inherits from falcon.HTTPError, and automatically converts it to an appropriate HTTP 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

Mixins

falcon.http_error.NoRepresentation

Predefined Errors

falcon