fix(profiler): do not exit on error but print it

This commit is contained in:
Jonathan Rainville 2018-12-20 13:16:33 -05:00 committed by Iuri Matias
parent b0c226a13f
commit e207537d6e
1 changed files with 8 additions and 2 deletions

View File

@ -33,7 +33,10 @@ class GasEstimator {
contractObj.methods[name] contractObj.methods[name]
.apply(contractObj.methods[name], []) .apply(contractObj.methods[name], [])
.estimateGas((err, gasAmount) => { .estimateGas((err, gasAmount) => {
if (err) return gasCb(err, name, abiMethod.type); if (err) {
self.logger.error(`Error getting gas estimate for "${name}"`, err.message || err);
return gasCb(null, name, abiMethod.type);
}
gasMap[name] = gasAmount; gasMap[name] = gasAmount;
return gasCb(null, name, abiMethod.type); return gasCb(null, name, abiMethod.type);
}); });
@ -42,7 +45,10 @@ class GasEstimator {
async.concat(fuzzMap[name], (values, getVarianceCb) => { async.concat(fuzzMap[name], (values, getVarianceCb) => {
contractObj.methods[name].apply(contractObj.methods[name], values) contractObj.methods[name].apply(contractObj.methods[name], values)
.estimateGas((err, gasAmount) => { .estimateGas((err, gasAmount) => {
getVarianceCb(err, gasAmount); if (err) {
self.logger.error(`Error getting gas estimate for "${name}"`, err.message || err);
}
getVarianceCb(null, gasAmount);
}); });
}, (err, variance) => { }, (err, variance) => {
if (variance.every(v => v === variance[0])) { if (variance.every(v => v === variance[0])) {