From 01260b889dc1e219e5f3ce82849fe2085717c37e Mon Sep 17 00:00:00 2001 From: Joris Bontje Date: Wed, 5 Aug 2015 14:35:39 +0200 Subject: [PATCH] default to empty set when chains.json is missing --- lib/chain_manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chain_manager.js b/lib/chain_manager.js index 157d6423..9dc8e5c3 100644 --- a/lib/chain_manager.js +++ b/lib/chain_manager.js @@ -3,17 +3,18 @@ var web3 = require('web3'); var sha3_256 = require('js-sha3').sha3_256; ChainManager = function() { + this.chainManagerConfig = {}; this.currentChain = {}; this.file = ""; } ChainManager.prototype.loadConfigFile = function(filename) { + this.file = filename; try { var obj = JSON.parse(fs.readFileSync(filename)); - this.file = filename; this.chainManagerConfig = obj; } catch (e) { - throw new Error("error reading " + filename); + console.warn("error reading " + filename + "; defaulting to empty set"); } return this; }; @@ -51,4 +52,3 @@ ChainManager.prototype.save = function() { } module.exports = ChainManager; -