Skip to content

Commit 610987f

Browse files
authored
Merge pull request #123 from apisearch-io/feature/transform-too-many-requests-exception
Transform exception when received the error
2 parents 30b5a18 + d3f6e97 commit 610987f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Http/HttpResponsesToException.php

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Apisearch\Exception\InvalidTokenException;
2222
use Apisearch\Exception\ResourceExistsException;
2323
use Apisearch\Exception\ResourceNotAvailableException;
24+
use Apisearch\Exception\TooManyRequestsException;
2425

2526
/**
2627
* Class HttpResponsesToException.
@@ -57,6 +58,8 @@ protected static function throwTransportableExceptionIfNeeded(
5758
throw new ResourceExistsException($response['body']['message']);
5859
case ForbiddenException::getTransportableHTTPError():
5960
throw new ForbiddenException($response['body']['message']);
61+
case TooManyRequestsException::getTransportableHTTPError();
62+
throw new TooManyRequestsException($response['body']['message']);
6063
case ConnectionException::getTransportableHTTPError():
6164
throw new ConnectionException('Apisearch returned an internal error code [500] - ' . $response['body']['message']);
6265
}

0 commit comments

Comments
 (0)