fix(deployment): add a message when the errror is about the input

This commit is contained in:
Jonathan Rainville 2018-11-15 14:19:44 -05:00
parent 21dff441d1
commit 7a5035ec49
3 changed files with 10 additions and 4 deletions

View File

@ -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",

View File

@ -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});
}

View File

@ -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();