rejectionhandled event doesn't fire on every handled rejection, but only if unhandledrejection events was triggered
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event
What specific section or headline is this issue about?
https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event#basic_error_logging
What information was incorrect, unhelpful, or incomplete?
The rejectionhandled event doesn't always trigger. Have a look here https://stackoverflow.com/a/57261820/3429430 There should be a note:
The rejectionhandled event doesn't fire on every handled rejection, it only fires on rejections that were not handled at first (causing unhandledrejection events) but then did subsequently get a handler attached.
What did you expect to see?
rejectionhandled being fired or an explanation of why id doesn't fire.
Do you have any supporting links, references, or citations?
https://stackoverflow.com/a/57261820/3429430
Do you have anything more you want to share?
No response
MDN metadata
Page report details
- Folder:
en-us/web/api/window/unhandledrejection_event - MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/window/unhandledrejection_event/index.md
- Last commit: https://github.com/mdn/content/commit/f7dae62645a2c735ed6f6ed63f664bf279fdfc4b
- Document last modified: 2022-09-09T05:19:45.000Z
Thanks for raising this — I’ve opened #22182 with a change to address it.
What specific section or headline is this issue about?
developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event#basic_error_logging
That section is an example in the unhandledrejection page. The information in the issue description and the Stack Overflow question and answer are about the rejectionhandled event. So it’s not clear to me why or how that would fit into that example in the unhandledrejection page. Therefore the change I made in #22182 is to the https://developer.mozilla.org/en-US/docs/Web/API/Window/rejectionhandled_event page itself.
@bsmth @sideshowbarker Hey guys, this info should also be added to the parent page "Using Promises"(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#promise_rejection_events).
Currently it says:
rejectionhandled Sent when a promise is rejected, after that rejection has been handled by the executor's reject function.
I'm not sure if sent and fire mean the same thing. IMO, It should explicitly mention that rejectionhandled is sent(fired?) only if unhandledrejection has been fired first.
I suggest raising a new issue for that