From 34647e7fdfd410536c113173520b4bf04ccc5467 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Fri, 12 Jan 2018 11:07:36 +0800 Subject: [PATCH] Web3 apis. --- src/Web3.php | 16 ++++------------ test/unit/Web3ApiTest.php | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Web3.php b/src/Web3.php index dcc792c..f659957 100644 --- a/src/Web3.php +++ b/src/Web3.php @@ -132,18 +132,10 @@ class Web3 } else { $methodObject = $this->methods[$method]; } - try { - if ($methodObject->validate($arguments)) { - $inputs = $methodObject->transform($arguments, $methodObject->inputFormatters); - $methodObject->arguments = $inputs; - $this->provider->send($methodObject, $callback); - } - } catch (\Exception $e) { - if (is_callable($callback) === true) { - call_user_func($callback, $e, null); - } else { - throw $e; - } + if ($methodObject->validate($arguments)) { + $inputs = $methodObject->transform($arguments, $methodObject->inputFormatters); + $methodObject->arguments = $inputs; + $this->provider->send($methodObject, $callback); } } } diff --git a/test/unit/Web3ApiTest.php b/test/unit/Web3ApiTest.php index c7c42fb..a46f504 100644 --- a/test/unit/Web3ApiTest.php +++ b/test/unit/Web3ApiTest.php @@ -102,13 +102,13 @@ class Web3ApiTest extends TestCase */ public function testWrongParam() { - // $this->expectException(RuntimeException::class); + $this->expectException(RuntimeException::class); $web3 = $this->web3; $web3->sha3($web3, function ($err, $hash) { if ($err !== null) { - return $this->assertTrue($err instanceof RuntimeException); + return $this->fail($err->getMessage()); } $this->assertTrue(true); });