diff --git a/src/Mailgun/Api/HttpApi.php b/src/Mailgun/Api/HttpApi.php index b2b7586..b612add 100644 --- a/src/Mailgun/Api/HttpApi.php +++ b/src/Mailgun/Api/HttpApi.php @@ -95,6 +95,8 @@ abstract class HttpApi throw HttpClientException::requestFailed($response); case 404: throw HttpClientException::notFound($response); + case 413: + throw HttpClientException::payloadTooLarge($response); case 500 <= $statusCode: throw HttpServerException::serverError($statusCode); default: diff --git a/src/Mailgun/Exception/HttpClientException.php b/src/Mailgun/Exception/HttpClientException.php index fd0c0bb..5c0eb1d 100644 --- a/src/Mailgun/Exception/HttpClientException.php +++ b/src/Mailgun/Exception/HttpClientException.php @@ -73,6 +73,11 @@ final class HttpClientException extends \RuntimeException implements Exception return new self('The endpoint you have tried to access does not exist. Check if the domain matches the domain you have configure on Mailgun.', 404, $response); } + public static function payloadTooLarge(ResponseInterface $response = null) + { + return new self('Payload too large, your total attachment size is too big.', 413, $response); + } + /** * @return ResponseInterface */