MCPcopy
hub / github.com/encode/starlette / __call__

Method __call__

starlette/middleware/exceptions.py:47–63  ·  view source on GitHub ↗
(self, scope: Scope, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

45 self._exception_handlers[exc_class_or_status_code] = handler
46
47 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
48 if scope["type"] not in ("http", "websocket"):
49 await self.app(scope, receive, send)
50 return
51
52 scope["starlette.exception_handlers"] = (
53 self._exception_handlers,
54 self._status_handlers,
55 )
56
57 conn: Request | WebSocket
58 if scope["type"] == "http":
59 conn = Request(scope, receive, send)
60 else:
61 conn = WebSocket(scope, receive, send)
62
63 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
64
65 async def http_exception(self, request: Request, exc: Exception) -> Response:
66 assert isinstance(exc, HTTPException)

Callers

nothing calls this directly

Calls 4

RequestClass · 0.90
WebSocketClass · 0.90
appMethod · 0.45

Tested by

no test coverage detected