Skip to content

Commit 3299db8

Browse files
cyberjunkyclaude
andcommitted
fix: preserve GarminConnectTooManyRequestsError through login exception handler
The bare except Exception block was catching and re-wrapping 429 errors from client.login() as GarminConnectConnectionError, hiding the real type from callers. Re-raise TooManyRequests and AuthenticationError directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 83da1cd commit 3299db8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

garminconnect/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,9 @@ def login(self, /, tokenstore: str | None = None) -> tuple[str | None, str | Non
709709
raise GarminConnectConnectionError(f"Login failed: {e}") from e
710710
except FileNotFoundError:
711711
raise
712+
except (GarminConnectTooManyRequestsError, GarminConnectAuthenticationError):
713+
raise
712714
except Exception as e:
713-
if isinstance(e, GarminConnectAuthenticationError):
714-
raise
715715
error_str = str(e).lower()
716716
auth_indicators = ["401", "unauthorized", "authentication", "login failed"]
717717
if any(indicator in error_str for indicator in auth_indicators):

0 commit comments

Comments
 (0)