Skip to content

Commit

Permalink
Throw original error if stat fails; to match sync implementation (#24)
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
RyanZim authored Feb 12, 2020
1 parent cde3270 commit 25231fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 25231fe

Please sign in to comment.