Skip to content

Commit

Permalink
errors: use determineSpecificType in more error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Sep 9, 2023
1 parent b500037 commit d72c65a
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 d72c65a

Please sign in to comment.