test: add unhandled rejection guard#17275
Conversation
|
Hi @MylesBorins, |
There was a problem hiding this comment.
would it maybe make sense to test the error object in the catch?
There was a problem hiding this comment.
Sure! I could make the change. Would it be a good start by testing the equality between the reason code input of static rejection and the error code inside the catch?
There was a problem hiding this comment.
@babygoat I think there's no rejection error code here - the rejection value itself is -1, I think, so it's a number and can't have properties of its own. We can test that the value is -1 here, though :)
There was a problem hiding this comment.
Hello @addaleax, thanks for your explanation! Yeah, you are right the rejection value is not an error object itself but a pure number (-1). But your suggestion is exactly the way I'm currently planning to do! Maybe I should provide the pseudo code for the implementation instead of only vague proposal. I rebase and upload the new commit for the further discussion
addaleax
left a comment
There was a problem hiding this comment.
LGTM with or without Myles' suggestion
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code.
8ee43b2 to
9711075
Compare
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code. PR-URL: nodejs#17275 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
|
Landed in ef49f55 |
|
@babygoat thanks a lot for your contribution and congratulations on your first commit to Node.js! 🎉 |
|
Thanks for your help, @BridgeAR ! Glad that I could help out and make it. |
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code. PR-URL: #17275 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code. PR-URL: nodejs#17275 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code. PR-URL: nodejs#17275 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code. Backport-PR-URL: #19447 PR-URL: #17275 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Add an unhandled rejection function in addons-napi/test_promise/test.js. Also, add a rejection handler to catch the unhandled rejection after introducing the guard and test the reason code. Backport-PR-URL: #19265 PR-URL: #17275 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Add an unhandled rejection function in
addons-napi/test_promise/test.js. Also, add a
rejection handler to catch the unhandled rejection
after introducing the guard and test the reason
code.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test