From 53fbddf1d6876ca7a5f685436f38e1a486d7be0b Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Fri, 14 Feb 2020 08:30:19 -0500 Subject: [PATCH] Add comment for clarity --- lib/mkdirs/make-dir.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mkdirs/make-dir.js b/lib/mkdirs/make-dir.js index 39654b48..ecfcaf60 100644 --- a/lib/mkdirs/make-dir.js +++ b/lib/mkdirs/make-dir.js @@ -82,6 +82,8 @@ module.exports.makeDir = async (input, options) => { try { const stats = await fs.stat(pth) if (!stats.isDirectory()) { + // This error is never exposed to the user + // it is caught below, and the original error is thrown throw new Error('The path is not a directory') } } catch { @@ -129,6 +131,8 @@ module.exports.makeDirSync = (input, options) => { try { if (!fs.statSync(pth).isDirectory()) { + // This error is never exposed to the user + // it is caught below, and the original error is thrown throw new Error('The path is not a directory') } } catch {