Merge pull request #1089 from embark-framework/bug_fix/deploy-error

Fix using an object as arguments
This commit is contained in:
Jonathan Rainville 2018-11-16 08:37:24 -05:00 committed by GitHub
commit c85c3bc809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 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});
}
@ -421,8 +421,7 @@ class ContractsManager {
if (Array.isArray(contract.args)) {
ref = contract.args;
} else {
let keys = Object.keys(contract.args);
ref = keys.map((k) => contract.args[k]).filter((x) => !x);
ref = Object.values(contract.args);
}
for (let j = 0; j < ref.length; j++) {

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