Skip to content

Commit dd1657b

Browse files
committed
Fixed regression with output generated via non-promise logic.
Improved promise handling logic.
1 parent f914100 commit dd1657b

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

bin/doxdox

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,8 @@ doxdox.parseInput(input, config, pkg).then(function (content) {
139139

140140
}
141141

142+
}).catch(function (err) {
143+
144+
console.error(err);
145+
142146
});

lib/doxdox.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,21 @@ module.exports.parseScripts = function (scripts, config, pkg) {
7878

7979
});
8080

81-
if (exports.templates[config.layout.toLowerCase()]) {
81+
try {
8282

83-
template = exports.templates[config.layout.toLowerCase()];
83+
if (exports.templates[config.layout.toLowerCase()]) {
8484

85-
} else if (fs.existsSync(path.resolve(config.layout))) {
85+
template = exports.templates[config.layout.toLowerCase()];
8686

87-
template = require(path.resolve(config.layout));
87+
} else if (fs.existsSync(path.resolve(config.layout))) {
88+
89+
template = require(path.resolve(config.layout));
90+
91+
}
92+
93+
} catch (e) {
94+
95+
deferred.reject(new Error('Invalid layout specified.'));
8896

8997
}
9098

@@ -105,11 +113,15 @@ module.exports.parseScripts = function (scripts, config, pkg) {
105113

106114
});
107115

116+
} else {
117+
118+
deferred.resolve(content);
119+
108120
}
109121

110122
} else {
111123

112-
console.error('Invalid layout specified.\n');
124+
deferred.reject(new Error('Invalid layout specified.'));
113125

114126
}
115127

lib/utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ module.exports.buildDashDocSet = function (input) {
8282

8383
});
8484

85-
db.close(function () {
85+
db.close(function (err) {
86+
87+
if (err) { return deferred.reject(err); }
8688

8789
zip.addFile(
8890
input.title + '.docset/Contents/Resources/docSet.dsidx',

0 commit comments

Comments
 (0)