Skip to content

Commit 939f8e8

Browse files
cjihrigMylesBorins
authored andcommitted
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: #35602 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent cd0b136 commit 939f8e8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/internal/fs/utils.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,8 @@ const defaultRmdirOptions = {
673673
};
674674

675675
const validateRmOptions = hideStackFrames((path, options, callback) => {
676-
try {
677-
options = validateRmdirOptions(options, defaultRmOptions);
678-
validateBoolean(options.force, 'options.force');
679-
} catch (err) {
680-
return callback(err);
681-
}
676+
options = validateRmdirOptions(options, defaultRmOptions);
677+
validateBoolean(options.force, 'options.force');
682678

683679
lazyLoadFs().stat(path, (err, stats) => {
684680
if (err) {

0 commit comments

Comments
 (0)