Skip to content

Commit

Permalink
errors: use determineSpecificType in more error messages
Browse files Browse the repository at this point in the history
PR-URL: #49580
Fixes: #49576
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Matthew Aitken <[email protected]>
  • Loading branch information
aduh95 committed Nov 2, 2024
1 parent 6ba4ebd commit c679348
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1354,17 +1354,11 @@ E('ERR_INVALID_REPL_EVAL_CONFIG',
E('ERR_INVALID_REPL_INPUT', '%s', TypeError);
E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => {
return `Expected a valid ${input} to be returned for the "${prop}" from the` +
` "${name}" function but got ${value}.`;
` "${name}" function but got ${determineSpecificType(value)}.`;
}, TypeError);
E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => {
let type;
if (value?.constructor?.name) {
type = `instance of ${value.constructor.name}`;
} else {
type = `type ${typeof value}`;
}
return `Expected ${input} to be returned for the "${prop}" from the` +
` "${name}" function but got ${type}.`;
` "${name}" function but got ${determineSpecificType(value)}.`;
}, TypeError);
E('ERR_INVALID_RETURN_VALUE', (input, name, value) => {
const type = determineSpecificType(value);
Expand Down

0 comments on commit c679348

Please sign in to comment.