ChakraCore: Detect unhandled promise rejection

http://www.ecma-international.org/ecma-262/7.0/#sec-host-promise-rejection-tracker

The following should log an error or warning on console:

new Promise((resolve, reject) => reject()) 

(Moved from UserVoice)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 26 (13 by maintainers)

Commits related to this issue

Most upvoted comments

OK, I think I’ve got a handle on this now, will aim to open the PR by the end of the weekend.

  • implement basic machinery for HostPromiseRejectionTracker
  • put in the hook for unhandledrejection
  • put in the hook for rejectionhandled
  • handle async functions correctly… sortof…
  • track the implementation through ch
  • write tests

Not yet sure how to go about tracking the change through ch - intending to add it as a command line option so will have to figure out how that works.

Just wanted apologise that I haven’t followed this up with a PR yet, I spent some time looking into it and it appears to be a lot more complicated than I at first thought, I will try and give it some more time in the next week or two, and will hopefully be able to submit a PR at some point in the next month or so - I can’t guarantee this though.

Thanks @MSLaguana . It makes sense to me to expose a hook for unhandledRejection in the engine.

@bterlson are there any other cases/events we should consider? AFAIK there’s at least rejectionhandled.

@agarwal-sandeep does the debugger need something like that as well?

@SaschaNaz @albertogasparin the uservoice for the Edge side of things has been corrected. You can now spend your points there 😃