node icon indicating copy to clipboard operation
node copied to clipboard

feat: improve error message

Open PriyanshusinghPanda opened this issue 1 month ago • 1 comments

Description

Improves the error message when process.cwd() fails because the current working directory no longer exists (e.g., was deleted).

Before


Error: ENOENT: no such file or directory, uv_cwd

After


Error: current working directory does not exist: process.cwd() failed because the directory was deleted

Changes

  • Modified lib/internal/bootstrap/switches/does_own_process_state.js to catch and enhance the ENOENT error message in wrappedCwd()
  • Added test/parallel/test-cwd-enoent-improved-message.js to verify the improved error message

Testing

  • ✅ All existing tests pass
  • ✅ New test added and passing
  • ✅ Linter passed
  • ✅ Manual verification successful
  • ✅ Backward compatibility maintained (error code and properties unchanged)

Fixes

  • Fixes: #57045

PriyanshusinghPanda avatar Dec 04 '25 18:12 PriyanshusinghPanda

Review requested:

  • [ ] @nodejs/startup

nodejs-github-bot avatar Dec 04 '25 18:12 nodejs-github-bot