From 25231fe7a734cca79860baf6522434623fc06efc Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com> Date: Wed, 12 Feb 2020 15:04:14 -0500 Subject: [PATCH] Throw original error if stat fails; to match sync implementation (#24) Fixes #23 --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 06ccc81..6135878 100644 --- a/index.js +++ b/index.js @@ -86,8 +86,12 @@ const makeDir = async (input, options) => { return make(pth); } - const stats = await stat(pth); - if (!stats.isDirectory()) { + try { + const stats = await stat(pth); + if (!stats.isDirectory()) { + throw new Error('The path is not a directory'); + } + } catch (_) { throw error; }