Permalink
Browse files

issue #64: friendly error in case of invalid config

  • Loading branch information...
1 parent 1a7c29a commit cf3bd88f820b2b21c099dfa1ce4036a8fd189b60 @afelix afelix committed Mar 8, 2013
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/freeze.js
View
@@ -146,10 +146,19 @@ var followSymlinks = exports.followSymlinks = function(path) {
var loadConfig = exports.loadConfig = function(path) {
if (configs.paths[path] !== undefined) return;
- if (FS.existsSync(PATH.join(path, '.borschik'))) {
+ var config_path = PATH.join(path, '.borschik');
+
+ if (FS.existsSync(config_path)) {
configs.paths[path] = true;
- var _config = JSON.parse(FS.readFileSync(PATH.join(path, '.borschik')));
+ try {
+ var _config = JSON.parse(FS.readFileSync(config_path));
+ } catch (e) {
+ if (e instanceof SyntaxError) {
+ console.error('Invalid config: ' + config_path);
+ }
+ throw e;
+ }
var paths = _config.paths || _config.pathmap || {};
for (var dir in paths) {

0 comments on commit cf3bd88

Please sign in to comment.