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

Consider aligning WebTransportError with upcoming guidance #425

Closed
domenic opened this issue Oct 10, 2022 · 7 comments · Fixed by #460
Closed

Consider aligning WebTransportError with upcoming guidance #425

domenic opened this issue Oct 10, 2022 · 7 comments · Fixed by #460
Assignees

Comments

@domenic
Copy link

domenic commented Oct 10, 2022

In whatwg/webidl#1211, we're attempting to give guidance on how to subclass DOMException, in a similar way to what WebTransportError does. However, our guidance differs from what you've done in the constructor signature, which it suggests would be (message, options) instead of putting message inside options.

We also have some shorthands which can let you avoid creating your own "set up" and "create" operations, which might be nice.

Is it too late to change the constructor signature for WebTransportError? It's a small surface thing, so I don't really want to cause people to do a lot of compat work if it's already shipping and being used extensively. But I thought it'd be worth asking...

@jan-ivar
Copy link
Member

@ricea does this SGTY?

@ricea
Copy link
Contributor

ricea commented Oct 13, 2022

It's a breaking change, because

writable.abort(new WebTransportError({streamErrorCode: WT_CODE}));

will create a WebTransportError object with a message of "[object Object]" and a null streamErrorCode. The server will see a different errorCode in the RESET_STREAM message.

On the other hand, I've found no evidence of it being used outside tests.

I have a mild preference for not changing it, because we'd have go through a shipping process for the change and there's no clear migration path, but I will be fine either way.

@wilaw wilaw added the Discuss at next meeting Flags an issue to be discussed at the next WG working label Oct 19, 2022
@jan-ivar
Copy link
Member

jan-ivar commented Oct 19, 2022

writable.abort(new WebTransportError({streamErrorCode: WT_CODE}));

will create a WebTransportError object with a message of "[object Object]" and a null streamErrorCode.

Won't this be TypeError, since {streamErrorCode: WT_CODE} isn't a DOMString?

@ricea
Copy link
Contributor

ricea commented Oct 24, 2022

Won't this be TypeError, since {streamErrorCode: WT_CODE} isn't a DOMString?

Almost anything is convertible to DOMString: https://webidl.spec.whatwg.org/#es-DOMString

@jan-ivar
Copy link
Member

jan-ivar commented Oct 25, 2022

Meeting:

  • @jan-ivar leaning towards fixing it.
  • Awkward if different browsers implement this differently.

@jan-ivar
Copy link
Member

I suggest we make a decision on this at next meeting.

@jan-ivar
Copy link
Member

Meeting:

  • No objections

@wilaw wilaw removed the Discuss at next meeting Flags an issue to be discussed at the next WG working label Jan 18, 2023
@wilaw wilaw added this to the Candidate Recommendation milestone Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants