mirror of https://github.com/nodejs/node.git
errors: refactor to use optional chaining
PR-URL: https://github.com/nodejs/node/pull/44184 Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
This commit is contained in:
parent
77def91bf9
commit
e3bf5e1ac8
|
@ -1337,7 +1337,7 @@ E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => {
|
|||
}, TypeError);
|
||||
E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => {
|
||||
let type;
|
||||
if (value && value.constructor && value.constructor.name) {
|
||||
if (value?.constructor?.name) {
|
||||
type = `instance of ${value.constructor.name}`;
|
||||
} else {
|
||||
type = `type ${typeof value}`;
|
||||
|
|
Loading…
Reference in New Issue