Skip to content

DOMException should have [[ErrorData]] internal slot #56497

Description

@petamoriken

Version

N/A

Platform

N/A

Subsystem

N/A

What steps will reproduce the bug?

This bug has not surfaced yet, but when V8 implements Error.isError, it should return true for DOMException.

Error.isError(new DOMException(1)) // => false, true expected

How often does it reproduce? Is there a required condition?

Not yet.

What is the expected behavior? Why is that the expected behavior?

Due to a change in Web IDL.
whatwg/webidl#1421

What do you see instead?

Not yet.

Additional information

This issue can be resolved by using Reflect.construct.
denoland/deno#27342

As a side effect, util.types.isNativeError will return true as well.

Activity

  1. changed the title [-]DONException should have `[[ErrorData]]` internal slot[/-] [+]`DONException` should have `[[ErrorData]]` internal slot[/+] on Jan 7, 2025
  2. ljharb commented on Jan 7, 2025

    @ljharb
    SponsorMember

    A simple way to do this might be making

    class DOMException {
    extend Error.

  3. changed the title [-]`DONException` should have `[[ErrorData]]` internal slot[/-] [+]`DOMException` should have `[[ErrorData]]` internal slot[/+] on Jan 7, 2025
  4. petamoriken commented on Jan 7, 2025

    @petamoriken
    ContributorAuthor

    A simple way to do this might be making

    node/lib/internal/per_context/domexception.js

    extend Error.

    I tried to implement inheriting Error in Deno, but it caused WPT fails.

    Object.getPrototypeOf(DOMException) === Function.prototype; // true

    https://github.com/web-platform-tests/wpt/blob/5799f5b24761cff805f20e5ec130bf3cb328e4ed/webidl/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js#L13-L15

  5. ljharb commented on Jan 7, 2025

    @ljharb
    SponsorMember

    @petamoriken indeed you'd have to Object.setPrototypeOf(DOMException.prototype, Function.prototype) or something as well.

  6. zloirock commented on May 3, 2025

    @zloirock

    V8 is updated to 13.6 with shipped Error.isError, this issue is not fixed, stable Node 24 is planned in some days.

  7. Amirali-Amirifar commented on May 3, 2025

    @Amirali-Amirifar

    Related to #40789

  8. added a commit that references this issue on May 9, 2025
  9. added a commit that references this issue on Jun 21, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions