From b0ffeb7bad84b37131a2d75e8b02812e37e929e9 Mon Sep 17 00:00:00 2001 From: dongwei <838456736@qq.com> Date: Thu, 17 Jan 2019 15:58:12 +0800 Subject: [PATCH] throw array 2 json --- src/Client.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 8c7e6a2..4a84519 100644 --- a/src/Client.php +++ b/src/Client.php @@ -125,7 +125,8 @@ class Client try { $body = \GuzzleHttp\json_decode($resp->getBody(), true); if (isset($body['error']) && isset($body['error']['code']) && isset($body['error']['message'])) { - throw new RpcServerException($body['error']['message'], $body['error']['code']); + $message = is_array($body['error']['message']) ? json_encode($body['error']['message']) : $body['error']['message']; + throw new RpcServerException($message, $body['error']['code']); } return $body['result'];