Sitelet https://web.archive.org/web/20220320025612/https://github.com/nodejs/node/commit/939f8e8bfa
Skip to content
Permalink
Browse files
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 <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>
  • Loading branch information
cjihrig authored and MylesBorins committed Oct 14, 2020
1 parent cd0b136 commit 939f8e8bfa19f8415b1004792fff0f45774df58f
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/internal/fs/utils.js
@@ -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) {

0 comments on commit 939f8e8

Please sign in to comment.