From 59f9d9fdf02e63c68b9e26709c830c56d2fb8ba0 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 30 Oct 2016 22:04:25 -0400 Subject: [PATCH] handle errors --- lib/index.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index 2580803d..936fec6f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -40,10 +40,6 @@ var Embark = { this.config = new Config({env: env}); this.config.loadConfigFiles(options); this.logger = new Logger({logLevel: 'debug'}); - - //this.contractsManager = new ContractsManager(configDir, files, env); - //this.contractsManager.init(); - //return this.contractsManager; }, redeploy: function(env) { @@ -55,7 +51,11 @@ var Embark = { }, self.buildDeployGenerate.bind(self) ], function(err, result) { - self.logger.trace("finished".underline); + if (err) { + self.logger.error(err.message); + } else { + self.logger.trace("finished".underline); + } }); }, @@ -130,12 +130,17 @@ var Embark = { callback(); } ], function(err, result) { - self.logger.setStatus("Ready".green); - self.logger.trace("finished".underline); + if (err) { + self.logger.error(err.message); + } else { + self.logger.setStatus("Ready".green); + self.logger.trace("finished".underline); + } }); }, build: function(env) { + var self = this; async.waterfall([ function deployAndGenerateABI(callback) { Embark.deploy(function(abi) { @@ -148,7 +153,11 @@ var Embark = { callback(); } ], function(err, result) { - self.logger.trace("finished".underline); + if (err) { + self.logger.error(err.message); + } else { + self.logger.trace("finished".underline); + } }); }, @@ -224,6 +233,9 @@ var Embark = { callback(null, abiGenerator.generateABI({useEmbarkJS: true})); } ], function(err, result) { + if (err) { + self.logger.error(err.message); + } done(result); }); },