InvalidArgumentException
This commit is contained in:
parent
e238a3596e
commit
08146f97d8
@ -39,7 +39,7 @@ class HttpRequestManager extends RequestManager implements IRequestManager
|
|||||||
public function sendPayload($payload, $callback)
|
public function sendPayload($payload, $callback)
|
||||||
{
|
{
|
||||||
if (!is_string($payload)) {
|
if (!is_string($payload)) {
|
||||||
throw new \RuntimeException('Payload must be string.');
|
throw new \InvalidArgumentException('Payload must be string.');
|
||||||
}
|
}
|
||||||
// $promise = $this->client->postAsync($this->host, [
|
// $promise = $this->client->postAsync($this->host, [
|
||||||
// 'headers' => [
|
// 'headers' => [
|
||||||
@ -67,8 +67,7 @@ class HttpRequestManager extends RequestManager implements IRequestManager
|
|||||||
$json = json_decode($res->getBody());
|
$json = json_decode($res->getBody());
|
||||||
|
|
||||||
if (JSON_ERROR_NONE !== json_last_error()) {
|
if (JSON_ERROR_NONE !== json_last_error()) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException('json_decode error: ' . json_last_error_msg());
|
||||||
'json_decode error: ' . json_last_error_msg());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
call_user_func($callback, null, $json);
|
call_user_func($callback, null, $json);
|
||||||
|
@ -68,7 +68,7 @@ class Web3
|
|||||||
$callback = array_pop($arguments);
|
$callback = array_pop($arguments);
|
||||||
|
|
||||||
if (is_callable($callback) !== true) {
|
if (is_callable($callback) !== true) {
|
||||||
throw new \RuntimeException('The last param must be callback function.');
|
throw new \InvalidArgumentException('The last param must be callback function.');
|
||||||
}
|
}
|
||||||
$this->provider->send($method, $arguments, $callback);
|
$this->provider->send($method, $arguments, $callback);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user