Skip to content

Commit

Permalink
Check if detail is a string
Browse files Browse the repository at this point in the history
Closes #16.
  • Loading branch information
GrahamCampbell committed Jun 29, 2019
1 parent 99c37e2 commit b91b845
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/HttpClient/Plugin/ExceptionThrower.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b91b845

Please sign in to comment.