-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: make lazyDOMException more common #39105
Conversation
if (DOMException === undefined) | ||
DOMException = internalBinding('messaging').DOMException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (DOMException === undefined) | |
DOMException = internalBinding('messaging').DOMException; | |
DOMException ??= internalBinding('messaging').DOMException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we use ??=
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find ??=
more readable and concise than the if
statement, feel free to disagree and/or disregard.
let DOMException; | ||
const lazyDOMException = hideStackFrames((message, name) => { | ||
if (DOMException === undefined) | ||
DOMException = internalBinding('messaging').DOMException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good to hoist this out of the crypto util and make it more universal in the code base, but I am wondering, why do we want to make this lazy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably to avoid building the JS function until we're on the error path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Landed in 2de139b |
PR-URL: #39105 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #39105 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
No description provided.