diff --git a/src/Messages/ExceptionErrorHandler.php b/src/Messages/ExceptionErrorHandler.php index 7b0ec90d..90ed2106 100644 --- a/src/Messages/ExceptionErrorHandler.php +++ b/src/Messages/ExceptionErrorHandler.php @@ -40,6 +40,12 @@ public function __invoke(ResponseInterface $response, RequestInterface $request) throw new ClientException\Server($responseBody['title'] . ': ' . $responseBody['detail']); } - throw new ClientException\Request($responseBody['title'] . ': ' . $responseBody['detail']); + $message = $responseBody['title'] ?? ''; + + if (isset($responseBody['detail'])) { + $message .= ': ' . $responseBody['detail']; + } + + throw new ClientException\Request($message); } }