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 authored and ruyadorno committed Sep 28, 2023
1 parent db3fc6d commit 6377f1b
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 @@ -1349,17 +1349,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 6377f1b

Please sign in to comment.