Skip to content

Commit

Permalink
fs: only show deprecation warning when error code matches
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jan 10, 2025
1 parent 529b56e commit 6f62176
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ let showExistsDeprecation = true;
function existsSync(path) {
try {
path = getValidatedPath(path);
} catch {
if (showExistsDeprecation) {
} catch (err) {
if (showExistsDeprecation && err?.code === 'ERR_INVALID_ARG_TYPE') {
process.emitWarning(
'Passing invalid argument types to fs.existsSync is deprecated', 'DeprecationWarning', 'DEP0187',
);
Expand Down

0 comments on commit 6f62176

Please sign in to comment.