Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

can something useful be reported about unhandled rejections? #75

Closed
sam-github opened this issue Mar 8, 2017 · 5 comments
Closed

can something useful be reported about unhandled rejections? #75

sam-github opened this issue Mar 8, 2017 · 5 comments

Comments

@sam-github
Copy link
Contributor

https://nodejs.org/api/process.html#process_event_unhandledrejection and the mention of a "PromiseHook C++ API" (nodejs/node#11752) sparked my curiousity, its an interesting thing to know about an applications state.

@Fishrock123
Copy link
Contributor

What kind of thing are you hoping for?

@Fishrock123
Copy link
Contributor

Fishrock123 commented Mar 13, 2017

like "these rejections happened before the crash" or something?

@Fishrock123
Copy link
Contributor

ping @sam-github

@sam-github
Copy link
Contributor Author

I was thinking specifically of the list of all promises that are currently rejected but do not have error handlers attached. Basically what the unhandledRejection event emits. However, it emits it after one "turn of the event loop" (an ill defined concept). Those promises may get an error handler attached sometime later... or may not, and their presence at time of node report may be interesting, if we know something about them that is reportable.

@Fishrock123
Copy link
Contributor

Hmmm, so I think this means hooking into v8::Isolate::SetPromiseRejectCallback() but that also then means we hijack core's handler...

So we might either have to add a c++ node api for that, or polyfill the node behavior from here...

Also, on shutdown we'd need to synchronously extract the "reason" data. Not too terribly difficult with the debug api, but very hacky and, well, the V8 people are not a fan of people using it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants