Skip to content

Should Error.isError return true for WebAssembly.Exception objects? #1914

Closed

Description

@Ms2ger

Activity

  1. ljharb commented on Jun 3, 2025

    @ljharb

    Yes, it should.

  2. eqrion commented on Jun 10, 2025

    @eqrion
    Collaborator

    WebAssembly.Exception objects intentionally don't inherit from Error (WebAssembly/exception-handling#183). I'm not familiar with the isError proposal, but from skimming it, that seems like it should mean that we should return false for WebAssembly.Exception objects.

  3. ljharb commented on Jun 10, 2025

    @ljharb

    It doesn’t have to inherit from Error to return true, but if the reasoning is so they don’t have stack traces, and assuming they don’t have special structuredClone serialization behavior, then the predicate should probably return false for them, yes.

  4. eqrion commented on Jun 10, 2025

    @eqrion
    Collaborator

    Yes, the main reason is to avoid requiring stack traces (although they can have them if the JS constructor is used with a flag [1]). They also are not structured cloneable.

    [1] https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md#api-additions

  5. eqrion commented on Oct 2, 2025

    @eqrion
    Collaborator

    It sounds like the consensus then is for Error.isError to return false for WA.Exception. It also sounds like that's the default behavior unless we added an [[ErrorData]] slot. So I think this should be closed (I don't have permissions).

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