From 66a3388a9d3332832716e3a6e673eb1312e9ba05 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 2 Mar 2018 17:48:30 -0500 Subject: [PATCH] fix error reporting for wrong params --- lib/contracts/deploy.js | 4 ++-- test_app/app/contracts/some_contract.sol | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test_app/app/contracts/some_contract.sol diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 58f644ec..3a3b09bb 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -270,8 +270,8 @@ class Deploy { try { deployObject = contractObject.deploy({arguments: contractParams, data: "0x" + contractCode}); } catch(e) { - if (e.indexOf('Invalid number of parameters for "undefined"') >= 0) { - return next(new Error("attempted to deploy " + contractObject.className + " without specifying parameters")); + if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) { + return next(new Error("attempted to deploy " + contract.className + " without specifying parameters")); } else { return next(new Error(e)); } diff --git a/test_app/app/contracts/some_contract.sol b/test_app/app/contracts/some_contract.sol new file mode 100644 index 00000000..a8b0d7f9 --- /dev/null +++ b/test_app/app/contracts/some_contract.sol @@ -0,0 +1,14 @@ +contract SomeContract { + address public addr_1; + address public addr_2; + uint public value; + + function() public payable { } + + function SomeContract(address _addresses, uint initialValue) public { + //addr_1 = _addresses[0]; + //addr_2 = _addresses[1]; + value = initialValue; + } + +}