From f35718b6c0f77192bf21a48579f5a16629e26b30 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 19 Jan 2018 20:38:28 -0500 Subject: [PATCH] error if account index is not found --- lib/contracts/deploy.js | 3 +++ test_app/config/contracts.json | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index 8a5df900..fb0c1c65 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -191,6 +191,9 @@ class Deploy { // applying deployer account configuration, if any if (typeof contract.fromIndex == 'number') { deploymentAccount = accounts[contract.fromIndex]; + if (deploymentAccount === undefined) { + return next("error deploying " + contract.className + ": no account found at index " + contract.fromIndex + " check the config"); + } } if (typeof contract.from == 'string' && typeof contract.fromIndex != 'undefined') { self.logger.warn('Both "from" and "fromIndex" are defined for contract "'+contract.className+'". Using "from" as deployer account.'); diff --git a/test_app/config/contracts.json b/test_app/config/contracts.json index 81470318..f1e342e1 100644 --- a/test_app/config/contracts.json +++ b/test_app/config/contracts.json @@ -21,6 +21,7 @@ "deploy": false }, "SimpleStorage": { + "fromIndex": 1, "args": [ 100 ]