Skip to content

Commit

Permalink
fix(@embark/deployment): ensure error messages emitted are logged
Browse files Browse the repository at this point in the history
Errors emitted as part of the `deployAll()` routine got swallowed by
Embark, leaving users in the unknown when the deployment process
"froze".

This commit ensures errors emitted are now logged, making it obvious
when something went wrong.
  • Loading branch information
0x-r4bbit committed Apr 17, 2019
1 parent b8357b7 commit 72fc80d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,11 @@ class ContractDeployer {
self.events.emit("deploy:contract:deployed", contract);

self.registerContract(contract, () => {
self.plugins.runActionsForEvent('deploy:contract:deployed', {contract: contract}, () => {
return next(null, receipt);
self.plugins.runActionsForEvent('deploy:contract:deployed', {contract: contract}, (err) => {
if (err) {
return next(err);
}
next(null, receipt);
});
});
}, hash => {
Expand Down
13 changes: 8 additions & 5 deletions packages/embark/src/lib/modules/deployment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DeployManager {
next();
});
},
function () {
function (next) {
const contractDeploys = {};
const errors = [];
contracts.forEach(contract => {
Expand Down Expand Up @@ -97,17 +97,20 @@ class DeployManager {
_err = __("Error deploying contracts. Please fix errors to continue.");
self.logger.error(_err);
self.events.emit("outputError", __("Error deploying contracts, please check console"));
return done(_err);
return next(_err);
}
if (contracts.length === 0) {
self.logger.info(__("no contracts found"));
return done();
return next();
}
self.logger.info(__("finished deploying contracts"));
done(err);
next(err);
});
}
]);
], (err) => {
self.logger.error(err);
done(err);
});
});
});
}
Expand Down

0 comments on commit 72fc80d

Please sign in to comment.