-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: throw rm() validation errors #35602
Conversation
This commit updates validateRmOptions() to throw on input validation failures. This is consistent with how Node handles validation in most places across the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding this correctly, parameter validation will be a crasher, but our enforcement of missing paths/file paths will bubble as an error to the callback?
Almost wonder if these should be two different utility methods, like validateRmOptions
, validateRmTarget
, not a blocker, just thinking out loud about a possible refactor.
That's right. Node's approach has historically been to throw on programming errors and use the callback for runtime errors.
If I was writing this from scratch, I'd do something like that. I mostly just wanted to get this change in before the new function goes out in a release. |
I'm surprised this doesn't require a test to be modified somewhere. Might be good to add a test for this. |
Fast-track? (to ensure we can get it into the last v14.x before LTS (refs: nodejs/Release#567 (comment)) |
Landed in ce4ac15...adf8f3d |
This commit updates validateRmOptions() to throw on input validation failures. This is consistent with how Node handles validation in most places across the codebase. PR-URL: #35602 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit updates validateRmOptions() to throw on input validation failures. This is consistent with how Node handles validation in most places across the codebase. PR-URL: #35602 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit updates validateRmOptions() to throw on input validation failures. This is consistent with how Node handles validation in most places across the codebase. PR-URL: nodejs#35602 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit updates
validateRmOptions()
to throw on input validation failures. This is consistent with how Node handles validation in most places across the codebase.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes