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.', }; /**