Skip to content

Commit 6377f1b

Browse files
aduh95ruyadorno
authored andcommitted
errors: use determineSpecificType in more error messages
PR-URL: #49580 Fixes: #49576 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
1 parent db3fc6d commit 6377f1b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/internal/errors.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1349,17 +1349,11 @@ E('ERR_INVALID_REPL_EVAL_CONFIG',
13491349
E('ERR_INVALID_REPL_INPUT', '%s', TypeError);
13501350
E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => {
13511351
return `Expected a valid ${input} to be returned for the "${prop}" from the` +
1352-
` "${name}" function but got ${value}.`;
1352+
` "${name}" function but got ${determineSpecificType(value)}.`;
13531353
}, TypeError);
13541354
E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => {
1355-
let type;
1356-
if (value?.constructor?.name) {
1357-
type = `instance of ${value.constructor.name}`;
1358-
} else {
1359-
type = `type ${typeof value}`;
1360-
}
13611355
return `Expected ${input} to be returned for the "${prop}" from the` +
1362-
` "${name}" function but got ${type}.`;
1356+
` "${name}" function but got ${determineSpecificType(value)}.`;
13631357
}, TypeError);
13641358
E('ERR_INVALID_RETURN_VALUE', (input, name, value) => {
13651359
const type = determineSpecificType(value);

0 commit comments

Comments
 (0)