From 0ebddef428fb48fe02c7c0a03ed9e42c097fd81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Szyma=C5=84ski?= Date: Mon, 16 Feb 2026 15:52:50 +0000 Subject: [PATCH] Surface too many requests exception --- pyiceberg/catalog/rest/response.py | 3 +++ pyiceberg/exceptions.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pyiceberg/catalog/rest/response.py b/pyiceberg/catalog/rest/response.py index 157e4bfa16..9c1c33dacb 100644 --- a/pyiceberg/catalog/rest/response.py +++ b/pyiceberg/catalog/rest/response.py @@ -28,6 +28,7 @@ RESTError, ServerError, ServiceUnavailableError, + TooManyRequestsError, UnauthorizedError, ) from pyiceberg.typedef import IcebergBaseModel @@ -79,6 +80,8 @@ def _handle_non_200_response(exc: HTTPError, error_handler: dict[int, type[Excep exception = RESTError elif code == 419: exception = AuthorizationExpiredError + elif code == 429: + exception = TooManyRequestsError elif code == 501: exception = NotImplementedError elif code == 503: diff --git a/pyiceberg/exceptions.py b/pyiceberg/exceptions.py index e755c73095..6bf9380a3f 100644 --- a/pyiceberg/exceptions.py +++ b/pyiceberg/exceptions.py @@ -84,6 +84,10 @@ class AuthorizationExpiredError(RESTError): """When the credentials are expired when performing an action on the REST catalog.""" +class TooManyRequestsError(RESTError): + """Raises when too many requests error is returned by the REST catalog.""" + + class OAuthError(RESTError): """Raises when there is an error with the OAuth call."""