Repository navigation
fix: surface server error-channel messages as warnings - #354
Open
saravanan619 wants to merge 2 commits into
Open
saravanan619 wants to merge 2 commits into
saravanan619 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #352
Bug
When the server rejects a subscription it sends a message on the
errorchannel.WebsocketManager.on_messagecallsws_msg_to_identifier, which had noerrorbranch, so it returnedNoneandon_messagelogged "Websocket not handling empty message" at DEBUG and dropped it. With default logging the caller saw nothing.Fix
ws_msg_to_identifiernow mapschannel == "error"to the"error"identifier.on_messagehandles that identifier before the subscription lookup: it logs the server error at WARNING level (including the full message, so it is visible by default) and returns, without routing it to any subscription.Tests
Added
tests/websocket_manager_test.py(plain pytest, no network):ws_msg_to_identifierreturns"error"for error-channel messages.Tests were written red first (2 failed on the unmodified code) and pass with the fix. Full suite: 39 passed offline with the repo's default pytest options (
--doctest-modules,--cov,--record-mode=once).