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 <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>
  • 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.