Skip to content

Commit

Permalink
Extend DOMException, approximately according to whatwg/webidl#1211
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Nov 22, 2022
1 parent bc4003a commit f08340a
Showing 1 changed file with 60 additions and 8 deletions.
68 changes: 60 additions & 8 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6544,9 +6544,57 @@ There are two ways to create pipelines:
return a `Promise` which resolves to a pipeline object when creation of the pipeline has
completed.

When this fails, the `Promise` rejects with an {{OperationError}}.
When this fails, the `Promise` rejects with a {{GPUPipelineError}}.

Issue: FIXME: Maybe in the case of an internal error it could be {{NotSupportedError}} or something?
<dfn interface>GPUPipelineError</dfn> describes a pipeline creation failure.

<script type=idl>
[Exposed=(Window, DedicatedWorker), SecureContext, Serializable]
interface GPUPipelineError : DOMException {
constructor(DOMString message, GPUPipelineErrorInit options);
readonly attribute GPUPipelineErrorReason reason;
};

dictionary GPUPipelineErrorInit {
required GPUPipelineErrorReason reason;
};

enum GPUPipelineErrorReason {
"validation",
"internal"
};
</script>

{{GPUPipelineError}} constructor:

<dl dfn-type=constructor dfn-for=GPUPipelineError data-timeline=content>
: <dfn>constructor()</dfn>
::
<div algorithm="GPUPipelineError constructor">
<pre class=argumentdef for="GPUPipelineError/constructor()">
|message|: Error message of the base {{DOMException}}.
|options|: Options specific to {{GPUPipelineError}}.
</pre>

1. Set [=this=].{{DOMException/name}} to `"GPUPipelineError"`.
1. Set [=this=].{{DOMException/message}} to |message|.
1. Set [=this=].{{GPUPipelineError/reason}} to |options|.{{GPUPipelineErrorInit/reason}}.
</div>
</dl>

{{GPUPipelineError}} objects are [=serializable objects=].

<div algorithm="GPUPipelineError serialization steps" data-timeline=content>
Their [=serialization steps=], given |value| and |serialized|, are:

1. Run the {{DOMException}} [=serialization steps=] given |value| and |serialized|.
</div>

<div algorithm="GPUPipelineError deserialization steps" data-timeline=content>
Their [=deserialization steps=], given |value| and |serialized|, are:

1. Run the {{DOMException}} [=deserialization steps=] given |value| and |serialized|.
</div>

## Base pipelines ## {#pipeline-base}

Expand Down Expand Up @@ -7205,12 +7253,16 @@ dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
<div data-timeline=content>
[=Content timeline=] steps:

1. If |pipeline| is...
1. If |pipeline|...
<dl class=switch>
: [=valid=]
:: [=Resolve=] |promise| with |pipeline|.
: [=invalid=]
:: [=Reject=] |promise| with an {{OperationError}}.
: [=invalid=] due to an [$internal error$]
:: [=Reject=] |promise| with a {{GPUPipelineError}} with
{{GPUPipelineErrorInit/reason}} {{GPUPipelineErrorReason/"internal"}}.
: [=invalid=] due to an [$validation error$]
:: [=Reject=] |promise| with a {{GPUPipelineError}} with
{{GPUPipelineErrorInit/reason}} {{GPUPipelineErrorReason/"validation"}}.
</dl>
</div>
</div>
Expand Down Expand Up @@ -7441,7 +7493,7 @@ dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
: [=valid=]
:: [=Resolve=] |promise| with |pipeline|.
: [=invalid=]
:: [=Reject=] |promise| with an {{OperationError}}.
:: [=Reject=] |promise| with a {{GPUPipelineError}}.
</dl>
</div>
</div>
Expand Down Expand Up @@ -12736,7 +12788,7 @@ lower memory requirement (like using smaller texture dimensions), or if memory u
resources is released first.

<div algorithm>
To <dfn abstract-op lt="Generate an out-of-memory error|generate an out-of-memory error">
To <dfn abstract-op lt="Generate an out-of-memory error|generate an out-of-memory error|out-of-memory error">
generate an out-of-memory error</dfn> for {{GPUDevice}} |device|, run the following steps:

<div data-timeline=content>
Expand All @@ -12761,7 +12813,7 @@ captured by the [=supported limits=]. The same operation may succeed on other de
difference circumstances.

<div algorithm>
To <dfn abstract-op lt="Generate an internal error|generate an internal error">generate an
To <dfn abstract-op lt="Generate an internal error|generate an internal error|internal error">generate an
internal error</dfn> for {{GPUDevice}} |device|, run the following steps:

<div data-timeline=content>
Expand Down

0 comments on commit f08340a

Please sign in to comment.