Skip to content

Commit 095e446

Browse files
authored
Merge pull request #61 from eman/fix/mark-network-errors-as-retriable
Mark network errors as retriable in authentication methods
2 parents 1b9ef36 + d7b84b6 commit 095e446

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/nwp500/auth.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,10 @@ async def sign_in(
447447

448448
except aiohttp.ClientError as e:
449449
_logger.error(f"Network error during sign-in: {e}")
450-
raise AuthenticationError(f"Network error: {str(e)}") from e
450+
raise AuthenticationError(
451+
f"Network error: {str(e)}",
452+
retriable=True,
453+
) from e
451454
except (KeyError, ValueError, json.JSONDecodeError) as e:
452455
_logger.error(f"Failed to parse authentication response: {e}")
453456
raise AuthenticationError(
@@ -545,7 +548,10 @@ async def refresh_token(
545548

546549
except aiohttp.ClientError as e:
547550
_logger.error(f"Network error during token refresh: {e}")
548-
raise TokenRefreshError(f"Network error: {str(e)}") from e
551+
raise TokenRefreshError(
552+
f"Network error: {str(e)}",
553+
retriable=True,
554+
) from e
549555
except (KeyError, ValueError, json.JSONDecodeError) as e:
550556
_logger.error(f"Failed to parse refresh response: {e}")
551557
raise TokenRefreshError(f"Invalid response format: {str(e)}") from e

0 commit comments

Comments
 (0)