display compilation and/or deployment error in the logs and status instead of crashing

This commit is contained in:
Iuri Matias 2016-10-29 11:08:10 -04:00
parent 816e67370a
commit 00dd8ecf91
1 changed files with 26 additions and 8 deletions

View File

@ -55,7 +55,6 @@ var Embark = {
},
self.buildDeployGenerate.bind(self)
], function(err, result) {
Embark.monitor.setStatus("Ready");
self.logger.trace("finished".underline);
});
},
@ -108,7 +107,7 @@ var Embark = {
callback();
}
], function(err, result) {
Embark.monitor.setStatus("Ready");
Embark.monitor.setStatus("Ready".green);
self.logger.trace("finished".underline);
});
},
@ -144,8 +143,12 @@ var Embark = {
contractsConfig: self.config.contractsConfig,
logger: Embark.logger
});
contractsManager.build();
callback(null, contractsManager);
try {
contractsManager.build();
callback(null, contractsManager);
} catch(err) {
callback(new Error(err.message));
}
},
function deployContracts(contractsManager, callback) {
@ -179,7 +182,11 @@ var Embark = {
}
], function(err, result) {
done(result);
if (err) {
done(err, null);
} else {
done(null, result);
}
});
},
@ -204,11 +211,15 @@ var Embark = {
buildDeployGenerate: function(done) {
var self = this;
Embark.monitor.setStatus("Deploying...".magenta.underline);
async.waterfall([
function deployAndBuildContractsManager(callback) {
Embark.monitor.setStatus("Deploying Contracts");
Embark.buildAndDeploy(function(contractsManager) {
callback(null, contractsManager);
Embark.buildAndDeploy(function(err, contractsManager) {
if (err) {
callback(err);
} else {
callback(null, contractsManager);
}
});
},
function generateConsoleABI(contractsManager, callback) {
@ -233,6 +244,13 @@ var Embark = {
callback();
}
], function(err, result) {
if (err) {
self.logger.error("error deploying");
self.logger.error(err.message);
Embark.monitor.setStatus("Deployment Error".red);
} else {
Embark.monitor.setStatus("Ready".green);
}
done(result);
});
},