-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
inspector: log exceptions in message handlers #14980
Conversation
I am not entirely sure what to do with the exceptions here.
Any suggestions on a best approach? |
@eugeneo ... would you consider these to be fatal events? If so, then option 5 would likely be best, but it's also the most draconian. If they are not fatal, then a 6th option would be to use process.emitWarning() to emit each message as a separate warning. Users can then decide for themselves how they would prefer to handle them (e.g. use the default output to stderr, redirect those to a file, register a warning handler, switch them off entirely, etc). |
@jasnell Thank you for the suggestion. I definitely don't think those events are fatal - so now the code emits warnings. |
test/inspector/test-bindings.js
Outdated
let attempt = 1; | ||
const promise = new Promise(function(resolve) { | ||
let count = 0; | ||
process.on('warning', () => { |
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.
you can use common.mustCall(3)
here to limit the number of warning events triggered.
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 with green CI and a suggestion.
Thank you for the review, I updated the code. CI: https://ci.nodejs.org/job/node-test-pull-request/9829/ |
Would it be possible to call the callbacks in a |
@TimothyGu I'm bit concerned it might be possible to deadlock inspector callback and never see the |
@eugeneo Sounds quite complicated… I'll defer to your judgment then! |
Hmm... Getting some failures on 32-bit systems. See: https://ci.nodejs.org/job/node-test-commit-linux/12132/nodes=debian8-x86/console |
@jasnell I'm fixing them - there's an unexpected warning firing there. |
CI failures were not caused by this CL but I am not confident with this test coverage enough to merge this PR. |
I've added in the |
Landed as 9bae3ea |
Fixes: #14965 PR-URL: #14980 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Fixes: #14965 PR-URL: #14980 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Fixes: #14965 PR-URL: #14980 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Fixes: nodejs#14965 PR-URL: nodejs#14980 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Timothy Gu <[email protected]>
Fixes: #14965
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
inspector: JS bindings were updated.