mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
fs: only show deprecation warning when error code matches
PR-URL: https://github.com/nodejs/node/pull/56549 Refs: https://github.com/nodejs/node/pull/55753 Reviewed-By: Jacob Smith <jacob@frende.me>
This commit is contained in:
@@ -278,8 +278,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',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user