-
I've put together a demonstration repository here: The important code is:
When I run that, I expect the exception (division by zero) to get caught, and for it to return json with the error message. I instead see a 500 with this traceback:
I'm trying to understand if this is to be expected, due to some consequence of async generators, or if this is an issue in Quart. I do get the exception handled if I move the try/catch inside response_stream, but was hoping to use it a level up (as this is a simplification of a more complex codebase). Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not sure this is possible in general, as |
Beta Was this translation helpful? Give feedback.
I'm not sure this is possible in general, as
return Response(response_stream())
creates and defines a 200 streamed response i.e. once created it can't be changed within the generator to a json error response.