diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-12 16:45:09 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-12 16:45:09 +0200 |
commit | 05403f527db38b069c7af9cdf3b12a6b13744e31 (patch) | |
tree | d08c96acfe1962d3b279fecee73eaead4f4ebe0b /lib/parse | |
parent | 53c72f08061094d895b3e81964ff2d2944a6d6a9 (diff) | |
download | gitbook-05403f527db38b069c7af9cdf3b12a6b13744e31.zip gitbook-05403f527db38b069c7af9cdf3b12a6b13744e31.tar.gz gitbook-05403f527db38b069c7af9cdf3b12a6b13744e31.tar.bz2 |
Fix bug that can happen when configuration file doesn't exist
Diffstat (limited to 'lib/parse')
-rw-r--r-- | lib/parse/parseConfig.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/parse/parseConfig.js b/lib/parse/parseConfig.js index 39d57f0..a411af8 100644 --- a/lib/parse/parseConfig.js +++ b/lib/parse/parseConfig.js @@ -20,15 +20,15 @@ function parseConfig(book) { } // Try loading it - return Promise.all([ - fs.loadAsObject(filename), - fs.statFile(filename) - ]) - .spread(function(cfg, file) { - return { - file: file, - values: cfg - }; + return fs.loadAsObject(filename) + .then(function(cfg) { + return fs.statFile(filename) + .then(function(file) { + return { + file: file, + values: cfg + }; + }); }) .fail(function(err) { if (err.code != 'MODULE_NOT_FOUND') throw(err); |