fix(ux): added error message for ENOTDIR (#26128)

This commit is contained in:
Dev Randalpura
2026-04-28 12:12:51 -05:00
committed by GitHub
parent b0ffa3b51e
commit 8e1cecac06
2 changed files with 16 additions and 0 deletions
@@ -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)(
@@ -52,6 +52,9 @@ const errorMessageGenerators: Record<string, (path?: string) => 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.',
};
/**