diff --git a/openfga_sdk/rest.py b/openfga_sdk/rest.py index dc7c701..d227e6a 100644 --- a/openfga_sdk/rest.py +++ b/openfga_sdk/rest.py @@ -27,6 +27,7 @@ RateLimitExceededError, ServiceException, UnauthorizedException, + ValidationException, ) logger = logging.getLogger(__name__) @@ -174,6 +175,9 @@ async def request( logger.debug("response body: %s", r.data) if not 200 <= r.status <= 299: + if r.status == 400: + raise ValidationException(http_resp=r) + if r.status == 401: raise UnauthorizedException(http_resp=r) diff --git a/openfga_sdk/sync/rest.py b/openfga_sdk/sync/rest.py index 0f07412..afad041 100644 --- a/openfga_sdk/sync/rest.py +++ b/openfga_sdk/sync/rest.py @@ -24,6 +24,7 @@ ApiValueError, ForbiddenException, NotFoundException, + RateLimitExceededError, ServiceException, UnauthorizedException, ValidationException, @@ -252,6 +253,9 @@ def request( if r.status == 404: raise NotFoundException(http_resp=r) + if r.status == 429: + raise RateLimitExceededError(http_resp=r) + if 500 <= r.status <= 599: raise ServiceException(http_resp=r)