Skip to content

ENOENT error message inconsistencies #12351

@vsemozhetbyt

Description

@vsemozhetbyt
  • Version: 8.0.0-rc.0
  • Platform: Windows 7 x64
  • Subsystem: errors, fs, libuv, process

Currently, most of the ENOENT error messages have a similar signature:

Error: ENOENT: no such file or directory, [call] '/full/path/to/filename'

For example:

fs.accessSync('does-not-exist'); // etc...
Error: ENOENT: no such file or directory, access '...does-not-exist'
Error: ENOENT: no such file or directory, chmod '...does-not-exist'
Error: ENOENT: no such file or directory, link '...does-not-exist' -> '...does-not-exist2'
Error: ENOENT: no such file or directory, lstat '...does-not-exist'
Error: ENOENT: no such file or directory, open '...does-not-exist'
Error: ENOENT: no such file or directory, readlink '...does-not-exist'
Error: ENOENT: no such file or directory, rename '...does-not-exist' -> '...does-not-exist2'
Error: ENOENT: no such file or directory, rmdir '...does-not-exist'
Error: ENOENT: no such file or directory, scandir '...does-not-exist'
Error: ENOENT: no such file or directory, stat '...does-not-exist'
Error: ENOENT: no such file or directory, unlink '...does-not-exist'
Error: ENOENT: no such file or directory, utime '...does-not-exist'

I've stumbled upon 2 cases that have different and somehow confusing signatures:

  1. Different order, no description, filename without quotes, no full path:
fs.watch('does-not-exist');
// Error: watch does-not-exist ENOENT
  1. No file name / path at all (the call name can be wrongly considered as the file name):
process.chdir('does-not-exist');
// Error: ENOENT: no such file or directory, uv_chdir

Are these cases worth unification? Can they be addressed in Node.js or they are libuv features?

Metadata

Metadata

Assignees

No one assigned

    Labels

    errorsIssues and PRs related to JavaScript errors originated in Node.js core.fsIssues and PRs related to the fs subsystem / file system.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions