Repository navigation
Pass subscription errors to an on_error callback - #259
Merged
Merged
Conversation
subscribe_for_vehicle_updates, subscribe_for_departure_schedules and subscribe_for_parallax_messages take an optional, keyword-only on_error, which gets the subscription's error messages. A field that fails GraphQL validation, for example, ends the subscription with an error message and no data; without on_error that's only logged at debug level, so the caller can't tell its subscription has stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reconnect subscribes again, so a subscription that keeps failing calls on_error each time until it's unsubscribed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
subscribe_for_vehicle_updates,subscribe_for_departure_schedulesandsubscribe_for_parallax_messagestake an optional, keyword-onlyon_error, passed to_start_subscriptionthe waysubscribe_for_parallax_command_statealready uses it.Why
When a subscription asks for a field that fails GraphQL validation, Rivian accepts the subscription, then sends an
errormessage ("Cannot query field …") and no data. Without anon_error, the client only logs that at debug level, so the caller can't tell its subscription has stopped.The integration's GraphQL position fixes (bretterer/home-assistant-rivian#355) are a subscription of their own, so that kind of failure falls back to Parallax's fixes without breaking anything. With this, the integration can also log a warning when it happens.
Changes
src/rivian/rivian.py: theon_errorparameter and docstrings. Existing callers are unaffected.tests/test_ws_monitor.py: for each of the three, anerrorfrom the server reacheson_error. These fail without the change.Testing
373 tests pass; ruff and mypy are clean.
🤖 Generated with Claude Code