Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into zl/04_29_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenthebuilder committed Apr 29, 2024
2 parents 4def20e + cf4936a commit f2ad618
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions replit_river/client_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from replit_river.error_schema import (
ERROR_CODE_STREAM_CLOSED,
ERROR_HANDSHAKE,
ERROR_SESSION,
RiverException,
)
from replit_river.messages import (
Expand Down
6 changes: 4 additions & 2 deletions replit_river/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ async def send_transport_message(
)
except websockets.exceptions.ConnectionClosed:
await websocket_closed_callback()
raise WebsocketClosedException()
raise WebsocketClosedException("Websocket closed during send message")
except RuntimeError:
# RuntimeError: Unexpected ASGI message 'websocket.send',
# after sending 'websocket.close'
await websocket_closed_callback()
raise WebsocketClosedException()
raise WebsocketClosedException(
"Websocket closed RuntimeError during send message"
)
except Exception as e:
raise FailedSendingMessageException(
f"Exception during send message : {type(e)} {e}"
Expand Down
2 changes: 1 addition & 1 deletion replit_river/server_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def _send_handshake_response(
procedureName=request_message.procedureName,
)

def websocket_closed_callback() -> None:
async def websocket_closed_callback() -> None:
logging.error("websocket closed before handshake response")

try:
Expand Down

0 comments on commit f2ad618

Please sign in to comment.