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."""