Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML integration #9

Closed
ljharb opened this issue Jun 11, 2024 · 6 comments · May be fixed by whatwg/webidl#1421
Closed

HTML integration #9

ljharb opened this issue Jun 11, 2024 · 6 comments · May be fixed by whatwg/webidl#1421

Comments

@ljharb
Copy link
Member

ljharb commented Jun 11, 2024

A PR will be needed, ideally before stage 2.7 (although this would otherwise be a concern to be addressed within 2.7) to ensure that DOM exceptions are considered to be Errors.

Some potential implementation strategies:

  1. add the ErrorData internal slot to DOM exceptions, and accept the implicit observable change when used with Object.prototype.toString and a deleted Symbol.toStringTag
  2. add a new host hook, that the web can use to indicate which of its errors are Errors
  3. optionally, check the host hook in Object.prototype.toString so that host errors are indistinguishable from true Error subclasses
@ljharb
Copy link
Member Author

ljharb commented Jun 11, 2024

(see #6)

@ljharb ljharb mentioned this issue Jun 11, 2024
22 tasks
@annevk
Copy link
Member

annevk commented Jul 4, 2024

The main place that needs changes is https://webidl.spec.whatwg.org/#js-exceptions, not HTML.

There might be some implications for HTML's StructuredSerializeInternal and friends as they currently branch on [[ErrorData]]. Perhaps that would allow us to redo whatwg/webidl#732 in some way whereby Web IDL no longer relies on HTML for that? Unclear.

I do kinda like 1 as it brings Error and DOMException even closer together.

cc @domenic

@domenic
Copy link
Member

domenic commented Jul 4, 2024

1 seems nicer to me, assuming implementations are willing to deal with the compat implications. Which seem like they should be minuscule, but, you never know.

@ljharb
Copy link
Member Author

ljharb commented Jul 4, 2024

I definitely agree that 1 seems nicer if we can swing it.

I’ll attempt a PR for that approach, and we can discuss further from there.

@ljharb
Copy link
Member Author

ljharb commented Jul 18, 2024

Filed whatwg/webidl#1421 as a starting point. I expect it'll need a lot of suggestions, so please review it!

@ljharb
Copy link
Member Author

ljharb commented Aug 28, 2024

The PR has been "directionally" approved, with only editorial changes needed, so I'm going to close this.

@ljharb ljharb closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants