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: nodejs#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 Trott committed Jan 14, 2020
1 parent b772b9a commit eb5e1dd
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 @@ -946,14 +946,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 eb5e1dd

Please sign in to comment.