413 error proper handle.

This commit is contained in:
Radoje Albijanic 2018-04-06 18:02:54 +02:00 committed by David Garcia
parent ef3dc6b8bf
commit e28065fe2e
2 changed files with 7 additions and 0 deletions

View File

@ -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:

View File

@ -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
*/