mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-25 22:36:06 +03:00
Support for HTTP 429 Too Many Requests code
This commit is contained in:
parent
f109b4a2f7
commit
a0352e8f51
@ -99,6 +99,8 @@ abstract class HttpApi
|
||||
throw HttpClientException::conflict($response);
|
||||
case 413:
|
||||
throw HttpClientException::payloadTooLarge($response);
|
||||
case 429:
|
||||
throw HttpClientException::tooManyRequests($response);
|
||||
case 500 <= $statusCode:
|
||||
throw HttpServerException::serverError($statusCode);
|
||||
default:
|
||||
|
@ -88,6 +88,11 @@ final class HttpClientException extends \RuntimeException implements Exception
|
||||
return new self('Payload too large, your total attachment size is too big.', 413, $response);
|
||||
}
|
||||
|
||||
public static function tooManyRequests(ResponseInterface $response)
|
||||
{
|
||||
return new self('Too many requests.', 429, $response);
|
||||
}
|
||||
|
||||
public static function forbidden(ResponseInterface $response)
|
||||
{
|
||||
$body = $response->getBody()->__toString();
|
||||
|
Loading…
Reference in New Issue
Block a user