diff --git a/src/AmoCRM/Client/AmoCRMApiRequest.php b/src/AmoCRM/Client/AmoCRMApiRequest.php index 8e46e5b2..7bea2563 100644 --- a/src/AmoCRM/Client/AmoCRMApiRequest.php +++ b/src/AmoCRM/Client/AmoCRMApiRequest.php @@ -594,6 +594,9 @@ private function parseResponse(ResponseInterface $response): array && !$decodedBody && !empty($bodyContents) ) { + if($e->getCode() == 429) { + throw new AmoCRMApiTooManyRequestsException("Too many requests", $e->getCode(), $this->getLastRequestInfo()); + } throw new AmoCRMApiException( "Response body is not json", $response->getStatusCode(), diff --git a/src/AmoCRM/Exceptions/AmoCRMApiTooManyRequestsException.php b/src/AmoCRM/Exceptions/AmoCRMApiTooManyRequestsException.php new file mode 100644 index 00000000..b16cb918 --- /dev/null +++ b/src/AmoCRM/Exceptions/AmoCRMApiTooManyRequestsException.php @@ -0,0 +1,14 @@ +