You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat: Improve retry and exception handling in the SDK clients (#171)
# Overview
The retry mechanism was incorrectly configured, resulting in capturing
and retrying on errors it shouldn't retry on, e.g.
`asyncio.CancelledError` or `asyncio.TimeoutError`. Instead of a
negative filter when using `tenacity`'s `retry` decorator, i.e.
`retry_if_not_exception_type((CompassClientError,))`, which captured a
lot more exceptions than we originally intended, we now specifically
list the exceptions that we know we want to retry on, or otherwise let
the error bubble.
This PR also improves the exception hierarchy by introducing a few new
exceptions to help us better communicate errors to the clients without
having to bubble or wrap httpx exceptions. Specifically, we are
introducing:
- CompassNetworkError
- CompassServerError
- CompassTimeoutError
As part of this PR, the `utils.py` module were refactored into multiple
files to avoid having a pile of utility functions dumped in a single
file.