File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,7 @@ async def _send_bytes_exc(self, data: bytes):
131131 # and re-raise it as a websocket.WebSocketDisconnect
132132 try :
133133 await self .ws .send_bytes (data )
134- except websockets .exceptions .ConnectionClosed as e :
135- raise websocket .WebSocketDisconnect () from e
136- except RuntimeError as e :
134+ except (websockets .exceptions .ConnectionClosed , starlette .websockets .WebSocketDisconnect , RuntimeError ) as e :
137135 # starlette throws a RuntimeError once you call send after the connection is closed
138136 raise websocket .WebSocketDisconnect () from e
139137
@@ -142,9 +140,7 @@ async def _send_text_exc(self, data: str):
142140 # and re-raise it as a websocket.WebSocketDisconnect
143141 try :
144142 await self .ws .send_text (data )
145- except websockets .exceptions .ConnectionClosed as e :
146- raise websocket .WebSocketDisconnect () from e
147- except RuntimeError as e :
143+ except (websockets .exceptions .ConnectionClosed , starlette .websockets .WebSocketDisconnect , RuntimeError ) as e :
148144 # starlette throws a RuntimeError once you call send after the connection is closed
149145 raise websocket .WebSocketDisconnect () from e
150146
You can’t perform that action at this time.
0 commit comments