mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-22 04:26:02 +03:00
Add Forbidden response
This commit is contained in:
parent
5cad522151
commit
c88f1bc174
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ composer.lock
|
|||||||
phpunit.phar
|
phpunit.phar
|
||||||
phpunit.xml
|
phpunit.xml
|
||||||
modd.conf
|
modd.conf
|
||||||
|
.idea
|
||||||
|
@ -85,6 +85,8 @@ abstract class HttpApi
|
|||||||
throw HttpClientException::unauthorized($response);
|
throw HttpClientException::unauthorized($response);
|
||||||
case 402:
|
case 402:
|
||||||
throw HttpClientException::requestFailed($response);
|
throw HttpClientException::requestFailed($response);
|
||||||
|
case 403:
|
||||||
|
throw HttpClientException::forbidden($response);
|
||||||
case 404:
|
case 404:
|
||||||
throw HttpClientException::notFound($response);
|
throw HttpClientException::notFound($response);
|
||||||
case 413:
|
case 413:
|
||||||
|
@ -83,6 +83,11 @@ final class HttpClientException extends \RuntimeException implements Exception
|
|||||||
return new self('Payload too large, your total attachment size is too big.', 413, $response);
|
return new self('Payload too large, your total attachment size is too big.', 413, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function forbidden(ResponseInterface $response)
|
||||||
|
{
|
||||||
|
return new self('Forbidden', 403, $response);
|
||||||
|
}
|
||||||
|
|
||||||
public function getResponse(): ?ResponseInterface
|
public function getResponse(): ?ResponseInterface
|
||||||
{
|
{
|
||||||
return $this->response;
|
return $this->response;
|
||||||
|
Loading…
Reference in New Issue
Block a user