fix(process): improve error message for process.cwd() when directory is deleted#57184
Closed
Ankush1oo8 wants to merge 15 commits intonodejs:mainfrom
Closed
fix(process): improve error message for process.cwd() when directory is deleted#57184Ankush1oo8 wants to merge 15 commits intonodejs:mainfrom
Ankush1oo8 wants to merge 15 commits intonodejs:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the error message thrown by
process.cwd()when the current working directory is deleted. Instead of throwing a new error, it enhances the original error message, making it clearer that the directory was deleted while the process was still inside it.Changes Made:
wrappedCwd()to enhance the existing error message forENOENT: uv_cwdinstead of creating a newErrorinstance.process.chdir()to switch directories).Before (Old Behavior):
When the working directory was deleted,
process.cwd()threw a generic error with little context:After (New Behavior):
Now, the error provides a more meaningful message:
Relevant Issue:
(If this PR fixes an issue, add the issue number here)
Example: Fixes #57045
PR-URL:
#57184
Reviewer Notes:
-added to docs