Skip to content

Commit 7231090

Browse files
Flarnacodebytere
authored andcommitted
errors: remove dead code in ERR_INVALID_ARG_TYPE
Remove unreachable code. As expected is converted to an Array the 'not ' check will be never executed. PR-URL: #31322 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 6598a08 commit 7231090

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

‎lib/internal/errors.js‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -941,14 +941,7 @@ E('ERR_INVALID_ARG_TYPE',
941941
consttype=name.includes('.') ? 'property' : 'argument';
942942
msg+=`"${name}" ${type} `;
943943
}
944-
945-
// determiner: 'must be' or 'must not be'
946-
if(typeofexpected==='string'&&expected.startsWith('not ')){
947-
msg+='must not be ';
948-
expected=expected.replace(/^not/,'');
949-
}else{
950-
msg+='must be ';
951-
}
944+
msg+='must be ';
952945

953946
consttypes=[];
954947
constinstances=[];

0 commit comments

Comments
(0)