diff --git a/src/Exception/BadRequestHttpException.php b/src/Exception/BadRequestHttpException.php index 424c7e12..6d93f80a 100644 --- a/src/Exception/BadRequestHttpException.php +++ b/src/Exception/BadRequestHttpException.php @@ -11,4 +11,8 @@ */ class BadRequestHttpException extends ClientErrorHttpException { + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#bad-request-exception)'; + } } diff --git a/src/Exception/ClientErrorHttpException.php b/src/Exception/ClientErrorHttpException.php index d87dc319..9b37b92f 100644 --- a/src/Exception/ClientErrorHttpException.php +++ b/src/Exception/ClientErrorHttpException.php @@ -11,4 +11,8 @@ */ class ClientErrorHttpException extends HttpException { + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#client-exception)'; + } } diff --git a/src/Exception/HttpException.php b/src/Exception/HttpException.php index c475d962..b36fb225 100644 --- a/src/Exception/HttpException.php +++ b/src/Exception/HttpException.php @@ -22,6 +22,8 @@ class HttpException extends RuntimeException public function __construct(string $message, RequestInterface $request, ResponseInterface $response, ?\Exception $previous = null) { + $message .= ' ' . $this->getAdditionalInformationMessage(); + parent::__construct($message, $response->getStatusCode(), $previous); $this->request = $request; @@ -43,4 +45,9 @@ public function getResponse(): ResponseInterface { return $this->response; } + + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#http-exception)'; + } } diff --git a/src/Exception/NotFoundHttpException.php b/src/Exception/NotFoundHttpException.php index 8c93dcbd..0249f445 100644 --- a/src/Exception/NotFoundHttpException.php +++ b/src/Exception/NotFoundHttpException.php @@ -11,4 +11,8 @@ */ class NotFoundHttpException extends ClientErrorHttpException { + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#not-found-exception)'; + } } diff --git a/src/Exception/ServerErrorHttpException.php b/src/Exception/ServerErrorHttpException.php index a2d268c3..8ee68e8a 100644 --- a/src/Exception/ServerErrorHttpException.php +++ b/src/Exception/ServerErrorHttpException.php @@ -11,4 +11,8 @@ */ class ServerErrorHttpException extends HttpException { + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#server-exception)'; + } } diff --git a/src/Exception/UnauthorizedHttpException.php b/src/Exception/UnauthorizedHttpException.php index 944cd565..62d64fd1 100644 --- a/src/Exception/UnauthorizedHttpException.php +++ b/src/Exception/UnauthorizedHttpException.php @@ -11,4 +11,8 @@ */ class UnauthorizedHttpException extends ClientErrorHttpException { + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#unauthorized-exception)'; + } } diff --git a/src/Exception/UnprocessableEntityHttpException.php b/src/Exception/UnprocessableEntityHttpException.php index 14989cfc..4a03163d 100644 --- a/src/Exception/UnprocessableEntityHttpException.php +++ b/src/Exception/UnprocessableEntityHttpException.php @@ -24,4 +24,9 @@ public function getResponseErrors(): array return isset($decodedBody['errors']) ? $decodedBody['errors'] : []; } + + protected function getAdditionalInformationMessage(): string + { + return '(see https://api.akeneo.com/php-client/exception.html#unprocessable-entity-exception)'; + } }