mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
fs: throw rm() validation errors
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: https://github.com/nodejs/node/pull/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 is contained in:
1 parent
cd0b1365ae
commit
939f8e8bfa
1 file changed
+2
-6
@@ -673,12 +673,8 @@ const defaultRmdirOptions = {
|
||||
};
|
||||
|
||||
const validateRmOptions = hideStackFrames((path, options, callback) => {
|
||||
try {
|
||||
options = validateRmdirOptions(options, defaultRmOptions);
|
||||
validateBoolean(options.force, 'options.force');
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
}
|
||||
options = validateRmdirOptions(options, defaultRmOptions);
|
||||
validateBoolean(options.force, 'options.force');
|
||||
|
||||
lazyLoadFs().stat(path, (err, stats) => {
|
||||
if (err) {
|
||||
|
||||
Reference in new issue
Block a user