Skip to content

Commit

Permalink
errors: remove dead code in ERR_INVALID_ARG_TYPE
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Flarna authored and codebytere committed Mar 17, 2020
1 parent 6598a08 commit 7231090
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,14 +941,7 @@ E('ERR_INVALID_ARG_TYPE',
const type = name.includes('.') ? 'property' : 'argument';
msg += `"${name}" ${type} `;
}

// determiner: 'must be' or 'must not be'
if (typeof expected === 'string' && expected.startsWith('not ')) {
msg += 'must not be ';
expected = expected.replace(/^not /, '');
} else {
msg += 'must be ';
}
msg += 'must be ';

const types = [];
const instances = [];
Expand Down

0 comments on commit 7231090

Please sign in to comment.