Skip to content

[v14.x-backport] node-api: rtn pending excep on napi_new_instance - #39516

Closed
legendecas wants to merge 1 commit into
nodejs:v14.x-stagingfrom
legendecas:backport-to-14/38798
Closed

[v14.x-backport] node-api: rtn pending excep on napi_new_instance#39516
legendecas wants to merge 1 commit into
nodejs:v14.x-stagingfrom
legendecas:backport-to-14/38798

Conversation

@legendecas

Copy link
Copy Markdown
Member

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

@github-actionsgithub-actionsBot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. v14.x labels Jul 25, 2021
@legendecaslegendecas changed the title node-api: rtn pending excep on napi_new_instance[v14.x-backport] node-api: rtn pending excep on napi_new_instanceJul 25, 2021
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So … this looks good, but:

When I reviewed the original PR, the reason I approved that this was a bugfix that aligned this call site with other call sites.

However, this prompted me to take another look at the source, it seems that CHECK_MAYBE_EMPTY most often uses napi_generic_failure – which seems pretty wrong? An empty maybe by definition indicates a pending exception.

@legendecas

legendecas commented Jul 26, 2021

Copy link
Copy Markdown
MemberAuthor

@addaleax previously we consider this returning status change as a possible ABI breaking change. However, the original PR does resolve a real problem, which we considered as a bug of node core. I believe it is time to re-evaluate if such a change is breaking anymore. If it is not been categorized as an ABI breaking change, we should apply the change on all other similar call sites.

/cc @nodejs/node-api

@legendecaslegendecas added the node-api Issues and PRs related to the Node-API. label Jul 26, 2021
@addaleax

Copy link
Copy Markdown
Member

@legendecas Yeah, I think this is either an all-or-nothing situation.

However, the original PR does resolve a real problem

But the same goes for the other call sites…?

@mhdawsonmhdawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@targos

Copy link
Copy Markdown
Member

Can you please rebase?

@targos

Copy link
Copy Markdown
Member

ping @legendecas

@legendecas

Copy link
Copy Markdown
MemberAuthor

@targos updated! :)

When there are any JavaScript exceptions pending,
`napi_pending_exception` should be returned.
PR-URL: nodejs#38798
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@targos
targosforce-pushed the backport-to-14/38798 branch from b55b2f9 to e999999CompareSeptember 1, 2021 17:34
targos pushed a commit that referenced this pull request Sep 3, 2021
When there are any JavaScript exceptions pending,
`napi_pending_exception` should be returned.
PR-URL: #38798
Backport-PR-URL: #39516
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
@targos

Copy link
Copy Markdown
Member

Landed in a74032a

@targostargos closed this Sep 3, 2021
@legendecas
legendecas deleted the backport-to-14/38798 branch March 25, 2022 16:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.node-apiIssues and PRs related to the Node-API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@legendecas@nodejs-github-bot@addaleax@targos@mhdawson