-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
node-api: correctly return pending exception status on napi_new_instance #38798
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
node-api: correctly return pending exception status on napi_new_instance #38798
Conversation
When there are any JavaScript exceptions pending, `napi_pending_exception` should be returned.
| // Ignore status and check napi_is_exception_pending() instead. | ||
|
|
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.
This comment looks a bit misplaced. Am I correct?
| // Ignore status and check napi_is_exception_pending() instead. | |
| // Ignore status and check napi_is_exception_pending() instead. |
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.
Eh, maybe not. The comment is actually for the line above, which means that the omitting of the checks on the returning status is intentional.
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.
Ah, I see. Perhaps it would be better to put the comment above the call (and the variable declaration)? If this is a convention in the codebase no problem then.
mhdawson
left a comment
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.
LGTM
When there are any JavaScript exceptions pending, `napi_pending_exception` should be returned. PR-URL: #38798 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <midawson@redhat.com>
|
Landed in 78af363 |
|
@mhdawson for my own education: did you shorten |
|
This needs #37217 to land on v14.x first (or needs to be manually backported). |
When there are any JavaScript exceptions pending,
napi_pending_exceptionshould be returned.Related: nodejs/node-addon-api#1000