Repository navigation
fix(socket_mode): re-raise the send error instead of AttributeError in websocket_client - #2068
Conversation
…n websocket_client When a send retry finds the session gone, the warning called self.session_id(), which the websocket_client SocketModeClient never defines, so callers got an AttributeError instead of the original WebSocketException and the warning was never logged. Drop the session id from the message, as the class's other log lines already do. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2068 +/- ##
==========================================
+ Coverage 84.67% 84.68% +0.01%
==========================================
Files 118 118
Lines 14119 14119
==========================================
+ Hits 11955 11957 +2
+ Misses 2164 2162 -2 ☔ View full report in Codecov by Harness. |
srtaalej
left a comment
There was a problem hiding this comment.
Ran the new test: it fails on main with AttributeError at the self.session_id() line and passes on this branch ✅ The rest of test_websocket_client.py passes too. I also checked that session_id() exists on the builtin and aiohttp clients but not on this one, so dropping it from the warning is the right fix. LGTM!
zimeg
left a comment
There was a problem hiding this comment.
🐍 @WilliamBergamin LGTM! Thanks for fixing the AttributeError so callers get the real WebSocketException.
Summary
This pull request makes the
websocket_clientSocket Mode client re-raise the originalWebSocketExceptionwhen a send retry finds the session gone, instead of anAttributeError.self.session_id(), which this client never defines (hidden by atype: ignore[attr-defined]), so the warning was never logged and callers catchingWebSocketExceptionmissed the error.WebSocketApphas no session id.Testing
The new test fails on
mainwithAttributeErrorand passes on this branch:sendraisesWebSocketExceptionand that reports as disconnected.send_messagelogs the warning and re-raises the same exception.Category
/docs(Documents)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.🤖 Generated with Claude Code