onunhandledrejection / onrejectionhandled event pages need updates

RESOLVED FIXED

Status

P5
normal
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: richardconnamacher, Assigned: sheppy)

Tracking

Details

(URL)

(Reporter)

Description

3 years ago
:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

The pages for the unhandledrejection and handledrejection events are out of date and should be updated. They incorrectly state that these events are not on a standards track, though they have since been added to WhatWG's HTML Living Standard. Their browser support table also should state that Chrome now supports it (at least in Chrome 49; I don't have a copy of Chrome 48 to test.)

Pages:
https://developer.mozilla.org/en-US/docs/Web/API/Window/onunhandledrejection
https://developer.mozilla.org/en-US/docs/Web/API/Window/onrejectionhandled

WhatWG Specification:
https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections

Test code:
window.addEventListener("unhandledrejection", function(event) {
    console.error("Unhandled rejection: ", event.reason, " in promise: ", event.promise);
});
Promise.reject("Test rejection");
(Assignee)

Comment 1

3 years ago
I'm working on this now.

Updated https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement to list these event handlers, have correct links, and include these event handlers in the compat table.

Moved/updated page: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onrejectionhandled
Moved/updated page: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onunhandledrejection

Created page: https://developer.mozilla.org/en-US/docs/Web/Events/unhandledrejection
Created page: https://developer.mozilla.org/en-US/docs/Web/Events/rejectionhandled
Created page: https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent

Removed "Unhandled Promise Rejection" from Template:SpecList, since this is part of HTML living standard now instead.

I'm doing the three subpages of PromiseRejectionEvent next, then I'll be done with this. I'll update the bug again when I'm finished.
Assignee: nobody → eshepherd
(Assignee)

Comment 2

3 years ago
More work...

Created page: https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent/promise
Created page: https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent/reason
Created page: https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent/PromiseRejectionEvent

And finished more cleanup and update work to the previously created pages.

I believe this topic is now fully covered in our reference. It probably could use a little article about how to use it, or something added if there's already content about debugging promises, but I'm going to leave it for now.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Assignee)

Comment 3

3 years ago
Updated the {{GroupData}} macro to include these events under "HTML DOM".
Florian: can you review the two pages:
https://developer.mozilla.org/en-US/docs/Web/Events/unhandledrejection
https://developer.mozilla.org/en-US/docs/Web/Events/rejectionhandled

I'm not sure they match the new way of doing it. In my head, properties were not listed there anymore, but I may be mistaken.
Flags: needinfo?(fscholz)
I reviewed the docs and made some corrections. Feedback is mostly nits. Nice work!

- Teoli is correct. No properties on the event pages as it is duplicate information. The listed properties were not exhaustive and we cannot maintain it twice. Instead explain the inheritance situation and point the relevant interfaces that document the properties already.

- Always use "Parameters", not "Arguments" (constructor page)

- I've added the two actual events to the PromiseRejectionEvent interface page, as I like the interface page to be a central point of information that links out to relevant pages. We can argue if we also want event handlers listed there. I don't know.

- Please only flag articles for tech/editorial review if you are really unsure what you have done.
Flags: needinfo?(fscholz)
(Assignee)

Comment 6

3 years ago
(In reply to Florian Scholz [:fscholz] (MDN) from comment #5)
> I reviewed the docs and made some corrections. Feedback is mostly nits. Nice
> work!

Thanks!

> - Teoli is correct. No properties on the event pages as it is duplicate
> information. The listed properties were not exhaustive and we cannot
> maintain it twice. Instead explain the inheritance situation and point the
> relevant interfaces that document the properties already.

OK; obviously I picked the wrong page to copy from as a template to begin my work. I was sure I'd gotten one of the new ones, but clearly not so much.

> - Always use "Parameters", not "Arguments" (constructor page)

Gah! I know this one, I can't believe I missed it!

> - I've added the two actual events to the PromiseRejectionEvent interface
> page, as I like the interface page to be a central point of information that
> links out to relevant pages. We can argue if we also want event handlers
> listed there. I don't know.

OK. I like this plan. I tried to follow what I thought were current page structures, but clearly I was using out-of-date pages as a starting point.

> - Please only flag articles for tech/editorial review if you are really
> unsure what you have done.

I tried to do just that. Given that I was not able to do a lot of testing of how this stuff worked, I figured tech reviews are worthwhile on some of these pages, and obviously the editorial reviews were justified. :)
You need to log in before you can comment on or make changes to this bug.