Generic ``Exception`` will handle all exceptions directly, including ``HTTPExceptions``.
(self, app, client)
| 281 | assert client.get("/not-found").data == b"404" |
| 282 | |
| 283 | def test_handle_generic(self, app, client): |
| 284 | """Generic ``Exception`` will handle all exceptions directly, |
| 285 | including ``HTTPExceptions``. |
| 286 | """ |
| 287 | |
| 288 | @app.errorhandler(Exception) |
| 289 | def handle_exception(e): |
| 290 | return self.report_error(e) |
| 291 | |
| 292 | assert client.get("/custom").data == b"direct Custom" |
| 293 | assert client.get("/error").data == b"direct KeyError" |
| 294 | assert client.get("/abort").data == b"direct InternalServerError" |
| 295 | assert client.get("/not-found").data == b"direct NotFound" |