Skip to content

reportException(ex) / reportError(ex) #38947

Closed
@benjamingr

Description

@benjamingr

Refs: whatwg/html#1196

The following API was suggested for HTML:

self.reportError(ex); // reports an exception - HTML's "report the error"
// Typically, beforehand to invoke an uncaught exception users did/do:
setTimeout(() => { throw e; }, 0);

From the top of my head, some people with opinions on these topics:
cc @ronag @mcollina @jasnell @Linkgoron @addaleax from Node.js
cc @annevk @domenic from whatwg about whether or not this makes sense from that angle
cc @benlesh for general interesting feedback and a library author PoV and for suggesting this


One big consideration here is that Node.js error handling model is different, if reportError does setTimeout(() => { throw e; }, 0); it's less a "report an error" and more a "crash the process with this uncauight exception".

One upside is that this API can let us provide better developer experience than a throw in a setTimeout since we can (in theory) preserve the stack and more information about the error state.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.discussIssues opened for discussions and feedbacks.errorsIssues and PRs related to JavaScript errors originated in Node.js core.feature requestIssues that request new features to be added to Node.js.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions