You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello folks,
Within the context of
@stream_with_context
and this old flask issue, I have a question:Is there any hook or facility to finish streaming content once an exception is raised within the generator?
Our current solution is to wrap the generator with a
try/except
block and yield "Output truncated - Exception..." when an exception is caught.The main problems are:
HTTP/1.0 200 OK
header has been sent but content is truncated due to the exception.Content-Length
header is absent."Output truncated - Exception..."
, there is no way to know there was such error.Perhaps the more fundamental question is:
How should one deal with abrupt terminations within a generator wired to
@stream_with_context
?Bit of extra context:
Beta Was this translation helpful? Give feedback.
All reactions