Skip to content

reportError could mention other error reporting use cases #35670

@camsteffen

Description

@camsteffen

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/reportError

What specific section or headline is this issue about?

The second paragraph starting "This feature is primarily intended for..."

This feature is primarily intended for custom event-dispatching or callback-manipulating libraries. Libraries can use this feature to catch errors in callback code and re-throw them to the top level handler. This ensures that an exception in one callback will not prevent others from being handled, while at the same time ensuring that stack trace information is still readily available for debugging at the top level.

What information was incorrect, unhelpful, or incomplete?

I think reportError is generally useful for reporting errors in application code, particularly if you have telemetry tools like Sentry installed. Or even without telemetry, it could be a reasonable coding style to use it for any case where an error occurs but you don't want to halt the current function. But this paragraph seems to nudge people away from using it unless you are writing a library or some low-level/framework code.

What did you expect to see?

Either include a broader set of possible use cases, or don't prescribe use cases at all. I think it would be enough to merely document behavior.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions