Skip to content

Commit b8865df

Browse files
aduh95RafaelGSS
authored andcommitted
fs: only show deprecation warning when error code matches
PR-URL: #56549 Refs: #55753 Reviewed-By: Jacob Smith <jacob@frende.me>
1 parent 9038498 commit b8865df

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎lib/fs.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ let showExistsDeprecation = true;
282282
functionexistsSync(path){
283283
try{
284284
path=getValidatedPath(path);
285-
}catch{
286-
if(showExistsDeprecation){
285+
}catch(err){
286+
if(showExistsDeprecation&&err?.code==='ERR_INVALID_ARG_TYPE'){
287287
process.emitWarning(
288288
'Passing invalid argument types to fs.existsSync is deprecated','DeprecationWarning','DEP0187',
289289
);

0 commit comments

Comments
 (0)