bocadillo.errors

HTTPError

HTTPError(self, status:int, detail:Any='')

Raised when an HTTP error occurs.

You can raise this within a view or an error handler to interrupt request processing.

Parameters

  • status (int or HTTPStatus): the status code of the error.
  • detail (any): extra detail information about the error. The exact rendering is determined by the configured error handler for HTTPError.

See Also

status_code

Return the HTTP error's status code, e.g. 404.

status_phrase

Return the HTTP error's status phrase, e.g. "Not Found".

title

Return the HTTP error's title, e.g. "404 Not Found".