How to handle exceptions raised from a Generator wired to a Response? #2814
Unanswered
wrkhenddher
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello folks,
Is there any hook or facility to finish streaming content once an exception is raised within a generator?
Our current solution is to wrap the generator with a try/except block and yield "Output truncated - Exception..." when an exception is caught.
Here is the traceback:
The main problems are:
Perhaps the more fundamental question is:
How should one deal with abrupt terminations within a generator wired to a response?
Bit of extra context:
PS/
See same question in flask's Q&A:
it was closed as NA
Beta Was this translation helpful? Give feedback.
All reactions