-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
n-api: test and doc napi_throw() of a primitive #20428
n-api: test and doc napi_throw() of a primitive #20428
Conversation
Not sure if the line above should also be corrected: |
@vsemozhetbyt good point! I'll change it. |
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 once the line above is updated as well.
I actually changed it to
|
k, good. |
4c9501a
to
d671d11
Compare
Ensure that napi_throw() is able to throw a primitive value, and document that it is able to throw any JavaScript value. Fixes: nodejs/abi-stable-node#309
d671d11
to
e11e3d9
Compare
I fixed a warning during the CI-lite. I'd actually like to run a full CI, because this includes code as well as doc: https://ci.nodejs.org/job/node-test-pull-request/14600/ |
Ensure that napi_throw() is able to throw a primitive value, and document that it is able to throw any JavaScript value. Fixes: nodejs/abi-stable-node#309 PR-URL: #20428 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Landed in bdf5be9. |
I comment on the commit itself but here for convenience: These tests do not test anything besides that the function call throws. The value as error validation does not verify anything. It is a no-op.
I get this back when running Object.getOwnPropertyNames(test_error) [ 'checkError',
'throwExistingError',
'throwError',
'throwRangeError',
'throwTypeError',
'throwErrorCode',
'throwRangeErrorCode',
'throwTypeErrorCode',
'createError',
'createRangeError',
'createTypeError',
'createErrorCode',
'createRangeErrorCode',
'createTypeErrorCode' ] |
@BridgeAR you're right! I guess As for the missing property, that's weird. |
@gabrielschulhof seems like the addons were not properly rebuild on my machine earlier. That is why I had issues with the missing property. I somehow had a weird state and had to explicitly reset everything addon related before they wanted to recompile. |
@BridgeAR I'm glad it's all good now :) |
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: nodejs#20428 (comment)
Ensure that napi_throw() is able to throw a primitive value, and document that it is able to throw any JavaScript value. Fixes: nodejs/abi-stable-node#309 PR-URL: #20428 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Replace assert.throws() with an explicit try/catch in order to catch the thrown value and be able to compare it strictly to an expected value. Re: #20428 (comment) PR-URL: #20487 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Ensure that napi_throw() is able to throw a primitive value, and
document that it is able to throw any JavaScript value.
Fixes: nodejs/abi-stable-node#309
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes