GeezerVison is showing github.com — errors: use `determineSpecificType` in more error messages · nodejs/node@c679348
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/errors.js +2-8Lines changed: 2 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1354,17 +1354,11 @@ E('ERR_INVALID_REPL_EVAL_CONFIG', |
1354 | 1354 | E('ERR_INVALID_REPL_INPUT', '%s', TypeError); |
1355 | 1355 | E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => { |
1356 | 1356 | return `Expected a valid ${input} to be returned for the "${prop}" from the` + |
1357 | | - ` "${name}" function but got ${value}.`; |
| 1357 | + ` "${name}" function but got ${determineSpecificType(value)}.`; |
1358 | 1358 | }, TypeError); |
1359 | 1359 | E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => { |
1360 | | - let type; |
1361 | | - if (value?.constructor?.name) { |
1362 | | - type = `instance of ${value.constructor.name}`; |
1363 | | - } else { |
1364 | | - type = `type ${typeof value}`; |
1365 | | - } |
1366 | 1360 | return `Expected ${input} to be returned for the "${prop}" from the` + |
1367 | | - ` "${name}" function but got ${type}.`; |
| 1361 | + ` "${name}" function but got ${determineSpecificType(value)}.`; |
1368 | 1362 | }, TypeError); |
1369 | 1363 | E('ERR_INVALID_RETURN_VALUE', (input, name, value) => { |
1370 | 1364 | const type = determineSpecificType(value); |
|