diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aa75bfc..f1a2076c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,10 +13,14 @@ Bocadillo adheres to [Semantic Versioning](https://semver.org). - Show Bocadillo version using `boca -v/-V/--version/version`. - Built-in `HTTPError` handlers: `error_to_html`, `error_to_media`, `error_to_text`. +### Changed + +- Exceptions raised in middleware callbacks were always handled by the HTML `HTTPError` handler. If configured, the one on the `API` will now be used instead. +- The default `HTTPError` handler now returns plaintext instead of HTML. + ### Fixed - Serving static files from a non-existing directory (including the default one) used to raise an invasive warning. It has been silenced. -- Exceptions raised in middleware callbacks were always handled by the HTML `HTTPError` handler. If configured, the one on the `API` will now be used instead. ### Removed diff --git a/bocadillo/error_handlers.py b/bocadillo/error_handlers.py index 8d62c8fb..04602755 100644 --- a/bocadillo/error_handlers.py +++ b/bocadillo/error_handlers.py @@ -44,7 +44,7 @@ def convert_exception_to_response( ): """Wrap call to `dispatch()` to always return an HTTP response.""" if error_handler is None: - error_handler = error_to_html + error_handler = error_to_text @wraps(dispatch) async def inner(req: Request) -> Response: