Skip to content

Commit e3bf5e1

Browse files
xtx1130F3n67u
authored andcommitted
errors: refactor to use optional chaining
PR-URL: #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>
1 parent 77def91 commit e3bf5e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => {
13371337
}, TypeError);
13381338
E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => {
13391339
let type;
1340-
if (value && value.constructor && value.constructor.name) {
1340+
if (value?.constructor?.name) {
13411341
type = `instance of ${value.constructor.name}`;
13421342
} else {
13431343
type = `type ${typeof value}`;

0 commit comments

Comments
 (0)