Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Exception/BadRequestHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
}
}
4 changes: 4 additions & 0 deletions src/Exception/ClientErrorHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
*/
class ClientErrorHttpException extends HttpException
{
protected function getAdditionalInformationMessage(): string
{
return '(see https://api.akeneo.com/php-client/exception.html#client-exception)';
}
}
7 changes: 7 additions & 0 deletions src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)';
}
}
4 changes: 4 additions & 0 deletions src/Exception/NotFoundHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
}
}
4 changes: 4 additions & 0 deletions src/Exception/ServerErrorHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
*/
class ServerErrorHttpException extends HttpException
{
protected function getAdditionalInformationMessage(): string
{
return '(see https://api.akeneo.com/php-client/exception.html#server-exception)';
}
}
4 changes: 4 additions & 0 deletions src/Exception/UnauthorizedHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
*/
class UnauthorizedHttpException extends ClientErrorHttpException
{
protected function getAdditionalInformationMessage(): string
{
return '(see https://api.akeneo.com/php-client/exception.html#unauthorized-exception)';
}
}
5 changes: 5 additions & 0 deletions src/Exception/UnprocessableEntityHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
}
}