File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,11 +60,11 @@ class JsonRPCClient
6060 * @var boolean
6161 */
6262 private $ notification = false ;
63-
63+
6464 /**
6565 * If false, requests will be forced to use fopen() instead.
6666 * This option is specific in case of cURL is callable but may not practically unsable.
67- *
67+ *
6868 * @var boolean
6969 */
7070 private $ enableCurl = true ;
@@ -184,24 +184,24 @@ public function __call($method, $params)
184184 if ($ response ['id ' ] != $ currentId ) {
185185 throw new \Exception ('Incorrect response id: ' . $ response ['id ' ] . ' (request id: ' . $ currentId . ') ' );
186186 }
187- if (! is_null ( $ response ['error ' ]) ) {
188- throw new \Exception ('Request error: ' . $ response ['error ' ]);
187+ if (array_key_exists ( ' error ' , $ response) && $ response ['error ' ] !== null ) {
188+ throw new \Exception ('Request error: ' . json_encode ( $ response ['error ' ]) );
189189 }
190190
191191 return $ response ['result ' ];
192192 } else {
193193 return true ;
194194 }
195195 }
196-
196+
197197 /**
198198 * Enable cURL when performs a jsonRCP request.
199199 */
200200 public function enableCurl ()
201201 {
202202 $ this ->enableCurl = true ;
203203 }
204-
204+
205205 /**
206206 * Disable cURL when performs a jsonRCP request.
207207 */
You can’t perform that action at this time.
0 commit comments