Skip to content

Commit

Permalink
Fix swallowed sync parse / compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 12, 2016
1 parent a4a3fb0 commit f206ad2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/unified.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ function unified() {
*/
function process(file, options, done) {
var complete = false;
var exception;

assertConcrete('process');
assertParser('process');
Expand All @@ -464,11 +465,18 @@ function unified() {
}, function (err) {
complete = true;

(done || bail)(err, file);
if (done) {
done(err, file);
} else {
exception = err;
}
});

assertDone('process', complete, done);

/* Throw sync error. */
bail(exception);

return file;
}

Expand Down

0 comments on commit f206ad2

Please sign in to comment.