File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change 2020# ERROR_CODE_UNKNOWN is the code for the RiverUnknownError
2121ERROR_CODE_UNKNOWN = "UNKNOWN"
2222
23+ # SESSION_STATE_MISMATCH is the code when the remote server rejects the session's state
24+ ERROR_CODE_SESSION_STATE_MISMATCH = "SESSION_STATE_MISMATCH"
25+
2326
2427class RiverError (BaseModel ):
2528 """Error message from the server."""
Original file line number Diff line number Diff line change 3333)
3434from replit_river .error_schema import (
3535 ERROR_CODE_CANCEL ,
36+ ERROR_CODE_SESSION_STATE_MISMATCH ,
3637 ERROR_CODE_STREAM_CLOSED ,
3738 ERROR_HANDSHAKE ,
3839 RiverError ,
@@ -314,6 +315,8 @@ async def websocket_closed_callback() -> None:
314315 "river client get handshake response : %r" , handshake_response
315316 ) # noqa: E501
316317 if not handshake_response .status .ok :
318+ if handshake_response .status .code == ERROR_CODE_SESSION_STATE_MISMATCH :
319+ await self .close ()
317320 raise RiverException (
318321 ERROR_HANDSHAKE ,
319322 f"Handshake failed with code { handshake_response .status .code } : " # noqa: E501
You can’t perform that action at this time.
0 commit comments