Skip to content

Avoid resubscribe stack trace for known exceptions - #447

Merged
Danielhiversen merged 1 commit into
Danielhiversen:masterfrom
MartinHjelmare:avoid-resubscribe-stack-trace
Aug 22, 2026
Merged

Avoid resubscribe stack trace for known exceptions#447
Danielhiversen merged 1 commit into
Danielhiversen:masterfrom
MartinHjelmare:avoid-resubscribe-stack-trace

Conversation

@MartinHjelmare

Copy link
Copy Markdown
Contributor

Tibber.execute is used during resubscribe to update data for the subscription. Calling Tibber.execute may raise exceptions. We should handle all those exceptions as known exceptions and don't log a stack trace.

When the access token expires during a resubscribe step (e.g. InvalidLoginError
with "exp" claim timestamp check failed), the error is expected and known.
Demote it from a full traceback (catch-all except Exception with exc_info=True)
to a plain warning by catching HttpExceptionError explicitly and logging the
error message without exc_info. Unknown/unexpected exceptions still emit the
full traceback. Add tests covering both cases.
@augmentcode

augmentcode Bot commented Aug 17, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR refines error handling during realtime subscription resynchronization.

Changes:

  • Recognizes HttpExceptionError separately in TibberHome._resubscribe_step.
  • Logs expected API failures as warnings without attaching a traceback.
  • Keeps traceback logging for unexpected exceptions and the existing transport-error behavior.
  • Adds coverage for invalid-login errors and unexpected errors to validate exc_info handling.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@Danielhiversen
Danielhiversen merged commit 62b5309 into Danielhiversen:master Aug 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants