summaryrefslogtreecommitdiffstats
path: root/lib/parse
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-05-12 16:45:09 +0200
committerSamy Pessé <samypesse@gmail.com>2016-05-12 16:45:09 +0200
commit05403f527db38b069c7af9cdf3b12a6b13744e31 (patch)
treed08c96acfe1962d3b279fecee73eaead4f4ebe0b /lib/parse
parent53c72f08061094d895b3e81964ff2d2944a6d6a9 (diff)
downloadgitbook-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.js18
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);