diff --git a/src/HttpClient/Plugin/ExceptionThrower.php b/src/HttpClient/Plugin/ExceptionThrower.php index b8653bd..489aabb 100644 --- a/src/HttpClient/Plugin/ExceptionThrower.php +++ b/src/HttpClient/Plugin/ExceptionThrower.php @@ -99,7 +99,7 @@ private static function getMessage(ResponseInterface $response) if ($error = ResponseMediator::getContent($response)['error'] ?? null) { if ($message = $error['message'] ?? null) { if ($detail = $error['detail'] ?? null) { - return sprintf('%s: %s', $message, strtok($detail, "\n")); + return sprintf('%s: %s', $message, strtok(is_string($detail) ? $detail : json_encode($detail), "\n")); } else { return $message; }