Skip to content

Streaming Response suppresses errors #1739

Discussion options

You must be logged in to vote
  1. If you are using the Starlette class as an ASGI app, then the middlewares ExceptionMiddleware and ServerErrorMiddleware would handle the error:
    • ExceptionMiddleware would usually transform the response into a 500 response - however, as the response has already started, ExceptionMiddleware then raises a RuntimeError instead;
    • ServerErrorMiddleware would also usually transform the response into a 500 response - but again, as the response has already started, that response is not sent. Then, ServerErrorMiddleware raises the error again, where it can be logged by the server;
    • When instantiating Starlette, you can pass exception_handlers that would be tasked with handling errors raised by Serve…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@RamiAwar
Comment options

@RamiAwar
Comment options

@jhominal
Comment options

jhominal Jul 6, 2022
Collaborator

@RamiAwar
Comment options

@RamiAwar
Comment options

Answer selected by RamiAwar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants