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 <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
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

+1-8
Original file line numberDiff line numberDiff line change
@@ -941,14 +941,7 @@ E('ERR_INVALID_ARG_TYPE',
941941
const type = name.includes('.') ? 'property' : 'argument';
942942
msg += `"${name}" ${type} `;
943943
}
944-
945-
// determiner: 'must be' or 'must not be'
946-
if (typeof expected === '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
const types = [];
954947
const instances = [];

0 commit comments

Comments
 (0)