node
node copied to clipboard
feat: improve error message
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.jsto catch and enhance the ENOENT error message inwrappedCwd() - Added
test/parallel/test-cwd-enoent-improved-message.jsto 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
Review requested:
- [ ] @nodejs/startup