Skip to content

Commit

Permalink
errors: refactor to use optional chaining
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xtx1130 authored and juanarbol committed Oct 11, 2022
1 parent aaad7a6 commit 9593c37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down

0 comments on commit 9593c37

Please sign in to comment.