warn about cycling dependencies

This commit is contained in:
Iuri Matias 2017-12-20 14:54:47 -05:00
parent eb43fa2526
commit 52953a1d0d
3 changed files with 12 additions and 1 deletions

View File

@ -204,7 +204,16 @@ class ContractsManager {
} }
} }
let orderedDependencies = toposort(converted_dependencies).reverse(); let orderedDependencies;
try {
orderedDependencies = toposort(converted_dependencies).reverse();
} catch(e) {
this.logger.error(("Error: " + e.message).red);
this.logger.error("there are two or more contracts that depend on each other in a cyclic manner".bold.red);
this.logger.error("Embark couldn't determine which one to deploy first".red);
process.exit(0);
}
let newList = contractList.sort(function (a, b) { let newList = contractList.sort(function (a, b) {
let order_a = orderedDependencies.indexOf(a.className); let order_a = orderedDependencies.indexOf(a.className);

View File

@ -55,6 +55,7 @@ class DeployManager {
function setDefaultAccount(contractsManager, web3, callback) { function setDefaultAccount(contractsManager, web3, callback) {
web3.eth.getAccounts(function (err, accounts) { web3.eth.getAccounts(function (err, accounts) {
if (err) { if (err) {
self.logger.error(err);
return callback(new Error(err)); return callback(new Error(err));
} }
let accountConfig = self.config.blockchainConfig.account; let accountConfig = self.config.blockchainConfig.account;

View File

@ -25,6 +25,7 @@ class TestLogger {
if (!(this.shouldLog('error'))) { if (!(this.shouldLog('error'))) {
return; return;
} }
console.error(txt);
this.logFunction(txt.red); this.logFunction(txt.red);
} }