You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should Error.isError return true for WebAssembly.Exception objects? #1914
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.
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.
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.
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).
Activity
ljharb commentedon Jun 3, 2025
Yes, it should.
eqrion commentedon Jun 10, 2025
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.
ljharb commentedon Jun 10, 2025
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.
eqrion commentedon Jun 10, 2025
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
eqrion commentedon Oct 2, 2025
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).
[JSC] Error.isError(WebAssembly.Exception) should be `false`
[wasm] Add the test for Error.isError(WebAssembly.Exception)
[wasm] Add the test for Error.isError(WebAssembly.Exception)
Bug 2007689 [wpt PR 56918] - [wasm] Add the test for Error.isError(We…
[wasm] Add the test for Error.isError(WebAssembly.Exception)