-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
[napi] properly initialize and check status (#12279) #12283
Conversation
Initialize status to napi_generic_failure and only check it after having made an actual N-API call. This fixes up 8fbace1.
A nit concerning commit messge (see guideline). It could be replaced by something like this (but it can be done by someone who will land this PR):
|
|
I think it could be considered green, but just in case: |
@@ -2162,7 +2162,7 @@ napi_status napi_instanceof(napi_env env, | |||
|
|||
if (env->has_instance_available) { | |||
napi_value value, js_result, has_instance = nullptr; | |||
napi_status status; | |||
napi_status status = napi_generic_failure; |
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 initiate with failure?
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.
Because then everything will come tumbling down if you compare the value without setting it first - on every platform, all the time.
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 mean why not napi_ok (which is 0)?
|
@refack Sorry, wrong hash in "Landed in...". And it is better to use full URL in |
Initialize status to napi_generic_failure and only check it after having made an actual N-API call. This fixes up 8fbace1. PR-URL: #12283 Ref: #12279 Reviewed-By: Refael Ackermann <[email protected]>
Actually landed in afd5966 |
Thanks for the quick fix/review/land, @gabrielschulhof @refack & @vsemozhetbyt! Still a bunch of infrastructure-related stuff going wrong on CI, but hopefully we get this all straightened out soon. Definitely highlights the room for improvement in our process, for sure. |
Thanks, and sorry about the fuss! |
💩 happens... |
nod |
Initialize status to napi_generic_failure and only check it after having made an actual N-API call. This fixes up 8fbace1. PR-URL: nodejs#12283 Ref: nodejs#12279 Reviewed-By: Refael Ackermann <[email protected]>
Initialize status to napi_generic_failure and only check it after having made an actual N-API call. This fixes up 8fbace1. Backport-PR-URL: #19447 PR-URL: #12283 Ref: #12279 Reviewed-By: Refael Ackermann <[email protected]>
Initialize status to napi_generic_failure and only check it after
having made an actual N-API call.
This fixes up 8fbace1.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
n-api