mirror of https://github.com/embarklabs/embark.git
default to empty set when chains.json is missing
This commit is contained in:
parent
1ff7d4bba3
commit
01260b889d
|
@ -3,17 +3,18 @@ var web3 = require('web3');
|
||||||
var sha3_256 = require('js-sha3').sha3_256;
|
var sha3_256 = require('js-sha3').sha3_256;
|
||||||
|
|
||||||
ChainManager = function() {
|
ChainManager = function() {
|
||||||
|
this.chainManagerConfig = {};
|
||||||
this.currentChain = {};
|
this.currentChain = {};
|
||||||
this.file = "";
|
this.file = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
ChainManager.prototype.loadConfigFile = function(filename) {
|
ChainManager.prototype.loadConfigFile = function(filename) {
|
||||||
|
this.file = filename;
|
||||||
try {
|
try {
|
||||||
var obj = JSON.parse(fs.readFileSync(filename));
|
var obj = JSON.parse(fs.readFileSync(filename));
|
||||||
this.file = filename;
|
|
||||||
this.chainManagerConfig = obj;
|
this.chainManagerConfig = obj;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error("error reading " + filename);
|
console.warn("error reading " + filename + "; defaulting to empty set");
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
@ -51,4 +52,3 @@ ChainManager.prototype.save = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ChainManager;
|
module.exports = ChainManager;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue