Sitelet https://github.com/gpuweb/gpuweb/pull/4292
Skip to content

Make GPUPipelineError constructor options optional - #4292

Closed
foolip wants to merge 1 commit into
gpuweb:mainfrom
foolip:patch-1
Closed

foolip wants to merge 1 commit into
gpuweb:mainfrom
foolip:patch-1

Conversation

@foolip

@foolip foolip commented Sep 15, 2023

Copy link
Copy Markdown
Contributor

The first argument is optional, so the second one also needs to be.

The first argument is optional, so the second one also needs to be.
@beaufortfrancois

Copy link
Copy Markdown
Contributor

@Kangz That seems reasonable to me. What do you think?

@github-actions

github-actions Bot commented Sep 15, 2023 •

Copy link
Copy Markdown
Contributor

Previews, as seen when this build job started (6a92d46):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

@Kangz

Kangz commented Sep 15, 2023

Copy link
Copy Markdown
Contributor

It seems good, but I'd like one of the spec editors @toji or @litherum to approve this.

@beaufortfrancois

Copy link
Copy Markdown
Contributor

As raised offline to @foolip, this spec PR needs to be updated as https://gpuweb.github.io/gpuweb/#dom-gpupipelineerror-constructor thinks options is always there:

            1. Set [=this=].{{GPUPipelineError/reason}} to |options|.{{GPUPipelineErrorInit/reason}}.

@foolip

foolip commented Sep 18, 2023

Copy link
Copy Markdown
Contributor Author

What was the intention between the spec as written? Maybe both arguments should be required instead of both being optional. In Chrome both are actually required, as calling new GPUPipelineError('bla') throws "TypeError: Failed to construct 'GPUPipelineError': The provided value is not of type 'GPUPipelineErrorInit'."

@toji

toji commented Sep 18, 2023

Copy link
Copy Markdown
Member

The reason attribute of the GPUPipelineError needs to be set to one of the valid enums, which I assume is the reason why the second arg is required even though it's nonsensical following a optional arg.

We could declare one of the enum values to be the default (probably "validation"?) and make the dict optional too, but I think it ultimately makes more sense to just make the message required. Devs can always pass empty string if there's really no message to be set.

@beaufortfrancois

Copy link
Copy Markdown
Contributor

I found #3709 which points to whatwg/webidl#1211.
We may want to wait for @kainino0x's return to understand how we can fix this.

@Kangz Kangz added copyediting Pure editorial stuff (copyediting, *.bs file syntax, etc.) tacit resolution queue Editors have agreed and intend to land if no feedback is given labels Sep 19, 2023
@Kangz Kangz added this to the Milestone 0 milestone Sep 19, 2023

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this is very much intentional, and per the example at https://webidl.spec.whatwg.org/#example-domexception-derived-interface. @beaufortfrancois found the correct context links. Please discuss with Domenic if you think this needs a change (see whatwg/webidl#1211 (comment)).

@toji

toji commented Oct 11, 2023

Copy link
Copy Markdown
Member

Thanks for the background on that, Kai! Still looks strange to me but it's pretty clear that the WebIDL spec expects this kind of usage based on the linked example.

@kainino0x kainino0x added tacit resolution candidate Editors may be able to resolve and move to tacit resolution queue and removed copyediting Pure editorial stuff (copyediting, *.bs file syntax, etc.) tacit resolution queue Editors have agreed and intend to land if no feedback is given labels Oct 11, 2023
@kainino0x kainino0x closed this Nov 20, 2023
@kainino0x kainino0x removed the tacit resolution candidate Editors may be able to resolve and move to tacit resolution queue label Nov 20, 2023
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 this pull request may close these issues.

6 participants