From 8e1cecac066025278925fc9ba2ddd2058275cd1f Mon Sep 17 00:00:00 2001 From: Dev Randalpura Date: Tue, 28 Apr 2026 12:12:51 -0500 Subject: [PATCH] fix(ux): added error message for ENOTDIR (#26128) --- packages/core/src/utils/fsErrorMessages.test.ts | 13 +++++++++++++ packages/core/src/utils/fsErrorMessages.ts | 3 +++ 2 files changed, 16 insertions(+) diff --git a/packages/core/src/utils/fsErrorMessages.test.ts b/packages/core/src/utils/fsErrorMessages.test.ts index c93272c179..f9b8c82bce 100644 --- a/packages/core/src/utils/fsErrorMessages.test.ts +++ b/packages/core/src/utils/fsErrorMessages.test.ts @@ -152,6 +152,19 @@ describe('getFsErrorMessage', () => { expected: 'Operation timed out. The network connection or filesystem operation took too long.', }, + { + code: 'ENOTDIR', + message: 'ENOTDIR: not a directory', + path: '/some/file.txt/inner', + expected: + "Not a directory: '/some/file.txt/inner'. Check if the path is correct and that all parent components are directories.", + }, + { + code: 'ENOTDIR', + message: 'ENOTDIR: not a directory', + expected: + 'Not a directory. Check if the path is correct and that all parent components are directories.', + }, ]; it.each(testCases)( diff --git a/packages/core/src/utils/fsErrorMessages.ts b/packages/core/src/utils/fsErrorMessages.ts index 396887c2cb..860e31bf2e 100644 --- a/packages/core/src/utils/fsErrorMessages.ts +++ b/packages/core/src/utils/fsErrorMessages.ts @@ -52,6 +52,9 @@ const errorMessageGenerators: Record string> = { 'Connection reset by peer. The network connection was unexpectedly closed.', ETIMEDOUT: () => 'Operation timed out. The network connection or filesystem operation took too long.', + ENOTDIR: (path) => + (path ? `Not a directory: '${path}'. ` : 'Not a directory. ') + + 'Check if the path is correct and that all parent components are directories.', }; /**