MCPcopy
hub / github.com/fastapi/fastapi / custom_handler

Function custom_handler

tests/test_ws_router.py:262–263  ·  view source on GitHub ↗
(websocket: WebSocket, exc: CustomError)

Source from the content-addressed store, hash-verified

260 """
261
262 async def custom_handler(websocket: WebSocket, exc: CustomError) -> None:
263 await websocket.close(1002, "foo")
264
265 myapp = make_app(exception_handlers={CustomError: custom_handler})
266 client = TestClient(myapp)

Callers

nothing calls this directly

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…