From 876b9b29476929f9b6749545f7b23a03d61e65a9 Mon Sep 17 00:00:00 2001 From: Jakub Svehla Date: Fri, 15 Nov 2024 21:35:51 +0100 Subject: [PATCH 1/2] Fix propagating exceptions --- src/quart/asgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quart/asgi.py b/src/quart/asgi.py index 856b55a..77fb81a 100644 --- a/src/quart/asgi.py +++ b/src/quart/asgi.py @@ -351,7 +351,7 @@ def _convert_version(raw: str) -> list[int]: async def _handle_exception(app: Quart, error: Exception) -> Response: - if not app.testing and app.config["PROPAGATE_EXCEPTIONS"]: + if not app.testing and not app.config["PROPAGATE_EXCEPTIONS"]: return await traceback_response(error) else: raise error From 9520b32a1e0518e6df7784b3faa62c229e32770b Mon Sep 17 00:00:00 2001 From: Jakub Svehla Date: Fri, 15 Nov 2024 22:16:20 +0100 Subject: [PATCH 2/2] Update exception handling tests --- tests/test_asgi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_asgi.py b/tests/test_asgi.py index 91f4dc0..fb3c997 100644 --- a/tests/test_asgi.py +++ b/tests/test_asgi.py @@ -319,10 +319,10 @@ def test_http_asgi_scope_from_request() -> None: @pytest.mark.parametrize( "propagate_exceptions, testing, raises", [ - (True, False, False), + (True, False, True), (True, True, True), (False, True, True), - (False, False, True), + (False, False, False), ], ) async def test__handle_exception(propagate_exceptions: bool, testing: bool, raises: bool) -> None: