Skip to content

Commit e485116

Browse files
committed
fix: add default val to throwIfNoEntry
1 parent 8265441 commit e485116

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/internal/fs/recursive_watch.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class FSWatcher extends EventEmitter {
5151

5252
assert(typeof options === 'object');
5353

54-
const { persistent, recursive, signal, encoding, ignore, throwIfNoEntry } = options;
54+
let { persistent, recursive, signal, encoding, ignore, throwIfNoEntry } = options;
5555

5656
// TODO(anonrig): Add non-recursive support to non-native-watcher for IBMi & AIX support.
5757
if (recursive != null) {
@@ -68,6 +68,8 @@ class FSWatcher extends EventEmitter {
6868

6969
if (throwIfNoEntry != null) {
7070
validateBoolean(throwIfNoEntry, 'options.throwIfNoEntry');
71+
} else {
72+
throwIfNoEntry = true;
7173
}
7274

7375
if (encoding != null) {
@@ -226,7 +228,7 @@ class FSWatcher extends EventEmitter {
226228
this.#watchFolder(filename);
227229
}
228230
} catch (error) {
229-
if (this.#options.throwIfNoEntry !== false && error.code === 'ENOENT') {
231+
if (!this.#options.throwIfNoEntry && error.code === 'ENOENT') {
230232
error.filename = filename;
231233
throw error;
232234
}

0 commit comments

Comments
 (0)