Skip to content
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

onerror and onunhandledrejection/onrejectionhandled could use some nice developer-friendly examples #676

Open
domenic opened this issue Feb 10, 2016 · 2 comments
Labels
clarification Standard could be clearer good first issue Ideal for someone new to a WHATWG standard or software project topic: error reporting

Comments

@domenic
Copy link
Member

domenic commented Feb 10, 2016

I notice that these features aren't really summarized anywhere developer-readable.

This is kind of a good first bug. Coming up with nice examples is an art. For promise rejection events, you can draw inspiration from https://nodejs.org/api/process.html#process_event_unhandledrejection. In all cases, I think it would be ideal to show use of something like navigator.sendBeacon for reporting the errors to the server.

I intend to work on this soon unless someone else volunteers. When that happens I'll update the assignee to myself and remove "good first bug". In the meantime, community members should feel free to use the comments to submit small examples that illustrate good production uses of these events.

@domenic domenic added clarification Standard could be clearer good first issue Ideal for someone new to a WHATWG standard or software project labels Feb 10, 2016
@kriskowal
Copy link

I did a prototype of a Chrome inspector panel for Q based on hooks for "defer", "progress", "resolve", "unhandled rejection", and "rejection handled" messages.

https://github.com/montagejs/continuum

There is a video demonstrating that these hooks are sufficient to create an inspector suitable for casually discovering "forever pending" promises as well as "never handled" rejections (for intuitive values of "forever" and "never").

This PR to Q would have introduced the necessary hooks. Watch for calls to the "debug" function.

https://github.com/kriskowal/q/pull/361/files

If I were to revisit this idea, it would be to provide Q.onevent hooks that an external library could hook up for each of these cases, sending messages to a tracing backend or inspector panel extension via window message passing.

@domenic
Copy link
Member Author

domenic commented Aug 7, 2024

In #10550 (comment) @jeremyroman notes that we should not just add clarifying web-developer-facing examples. We should also explain the setup for implementers. There are enough moving pieces that it's confusing: the outstanding rejected promises weak set, the about-to-be-notified rejected promises list, the HostPromiseRejectionTracker abstract op, and the notify about rejected promises algorithm. What they're all working to accomplish can be hard to understand, so explaining the moving pieces alongside any examples we introduce would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer good first issue Ideal for someone new to a WHATWG standard or software project topic: error reporting
Development

No branches or pull requests

2 participants