From 7a5035ec49a88d9f8e073988f102e398858ad34e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 15 Nov 2018 14:19:44 -0500 Subject: [PATCH] fix(deployment): add a message when the errror is about the input --- src/lib/constants.json | 6 ++++-- src/lib/modules/contracts_manager/index.js | 4 ++-- src/lib/modules/deployment/index.js | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/constants.json b/src/lib/constants.json index b64d4598f..51318d742 100644 --- a/src/lib/constants.json +++ b/src/lib/constants.json @@ -41,7 +41,9 @@ "testnet": 3, "ropsten": 3, "rinkeby": 4 - } + }, + "gasAllowanceError": "Returned error: gas required exceeds allowance or always failing transaction", + "gasAllowanceErrorMessage": "Failing call, this could be because of invalid inputs or function guards that may have been triggered, or an unknown error." }, "storage": { "init": "init", @@ -62,4 +64,4 @@ "explicit": "explicit" }, "embarkResourceOrigin": "http://embark" -} \ No newline at end of file +} diff --git a/src/lib/modules/contracts_manager/index.js b/src/lib/modules/contracts_manager/index.js index 40d970cf1..668bdf4a1 100644 --- a/src/lib/modules/contracts_manager/index.js +++ b/src/lib/modules/contracts_manager/index.js @@ -124,8 +124,8 @@ class ContractsManager { res.send({result}); }); } catch (e) { - if (funcCall === 'call' && e.message === 'Returned error: gas required exceeds allowance or always failing transaction') { - return res.send({result: 'Failing call, this could be because of invalid inputs or function guards that may have been triggered, or an unknown error.'}); + if (funcCall === 'call' && e.message === constants.blockchain.gasAllowanceError) { + return res.send({result: constants.blockchain.gasAllowanceErrorMessage}); } res.send({result: e.message}); } diff --git a/src/lib/modules/deployment/index.js b/src/lib/modules/deployment/index.js index 7f8e9c608..262db6a04 100644 --- a/src/lib/modules/deployment/index.js +++ b/src/lib/modules/deployment/index.js @@ -2,6 +2,7 @@ let async = require('async'); const ContractDeployer = require('./contract_deployer.js'); const cloneDeep = require('clone-deep'); +const constants = require('../../constants'); class DeployManager { constructor(embark, options) { @@ -66,6 +67,9 @@ class DeployManager { if (err) { contract.error = err.message || err; self.logger.error(`[${contract.className}]: ${err.message || err}`); + if (contract.error === constants.blockchain.gasAllowanceError) { + self.logger.error(constants.blockchain.gasAllowanceErrorMessage); + } errors.push(err); } callback();