diff --git a/src/unstructured_client/_version.py b/src/unstructured_client/_version.py index 5bfb2929..e3a41815 100644 --- a/src/unstructured_client/_version.py +++ b/src/unstructured_client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "unstructured-client" -__version__: str = "0.43.2" +__version__: str = "0.43.3" __openapi_doc_version__: str = "1.2.31" __gen_version__: str = "2.680.0" -__user_agent__: str = "speakeasy-sdk/python 0.43.2 2.680.0 1.2.31 unstructured-client" +__user_agent__: str = "speakeasy-sdk/python 0.43.3 2.680.0 1.2.31 unstructured-client" try: if __package__ is not None: diff --git a/src/unstructured_client/utils/retries.py b/src/unstructured_client/utils/retries.py index 375d5e0a..4b903b58 100644 --- a/src/unstructured_client/utils/retries.py +++ b/src/unstructured_client/utils/retries.py @@ -172,7 +172,11 @@ def retry_with_backoff( if isinstance(exception, TemporaryError): return exception.response - raise + elapsed_seconds = (now - start) / 1000 + raise type(exception)( + f"{type(exception).__name__} after {retries + 1} attempts " + f"over {elapsed_seconds:.1f}s: {exception}" + ) from exception sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) sleep = min(sleep, max_interval / 1000) time.sleep(sleep) @@ -200,7 +204,11 @@ async def retry_with_backoff_async( if isinstance(exception, TemporaryError): return exception.response - raise + elapsed_seconds = (now - start) / 1000 + raise type(exception)( + f"{type(exception).__name__} after {retries + 1} attempts " + f"over {elapsed_seconds:.1f}s: {exception}" + ) from exception sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) sleep = min(sleep, max_interval / 1000) await asyncio.sleep(sleep)