Skip to content

Commit d5d4cb8

Browse files
committed
Merge pull request #51 from jorisbontje/47-default-chains-json
default to empty set when chains.json is missing
2 parents 11076ab + 01260b8 commit d5d4cb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/chain_manager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ var web3 = require('web3');
33
var sha3_256 = require('js-sha3').sha3_256;
44

55
ChainManager = function() {
6+
this.chainManagerConfig = {};
67
this.currentChain = {};
78
this.file = "";
89
}
910

1011
ChainManager.prototype.loadConfigFile = function(filename) {
12+
this.file = filename;
1113
try {
1214
var obj = JSON.parse(fs.readFileSync(filename));
13-
this.file = filename;
1415
this.chainManagerConfig = obj;
1516
} catch (e) {
16-
throw new Error("error reading " + filename);
17+
console.warn("error reading " + filename + "; defaulting to empty set");
1718
}
1819
return this;
1920
};
@@ -51,4 +52,3 @@ ChainManager.prototype.save = function() {
5152
}
5253

5354
module.exports = ChainManager;
54-

0 commit comments

Comments
 (0)