MCPcopy Index your code
hub / github.com/plotly/dash / _handle_error

Method _handle_error

dash/backends/_fastapi.py:189–206  ·  view source on GitHub ↗

Handle exceptions during request processing.

(
        self, error: Exception, scope: Scope, receive: Receive, send: Send
    )

Source from the content-addressed store, hash-verified

187 return timing_information
188
189 async def _handle_error(
190 self, error: Exception, scope: Scope, receive: Receive, send: Send
191 ) -> None:
192 """Handle exceptions during request processing."""
193 if isinstance(error, PreventUpdate):
194 response = Response(status_code=204)
195 elif self.dash_server.error_handling_mode in ["raise", "prune"]:
196 tb = self.dash_server._get_traceback(None, error) # pylint: disable=W0212
197 response = Response(content=tb, media_type="text/html", status_code=500)
198 else:
199 response = JSONResponse(
200 status_code=500,
201 content={
202 "error": "InternalServerError",
203 "message": "An internal server error occurred.",
204 },
205 )
206 await response(scope, receive, send)
207
208 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
209 # Handle lifespan events (startup/shutdown)

Callers 1

__call__Method · 0.95

Calls 1

_get_tracebackMethod · 0.45

Tested by

no test coverage detected