From f206ad26942edc51a235ef6d8517133bf1daeac3 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sun, 12 Jun 2016 14:50:48 +0200 Subject: [PATCH] Fix swallowed sync parse / compile error --- lib/unified.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/unified.js b/lib/unified.js index 01f1b8bf..2e8a22f7 100644 --- a/lib/unified.js +++ b/lib/unified.js @@ -446,6 +446,7 @@ function unified() { */ function process(file, options, done) { var complete = false; + var exception; assertConcrete('process'); assertParser('process'); @@ -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; }