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

Clarify popErrorScope() rejects with OperationError if the device is lost - #433

Merged
kainino0x merged 3 commits into
gpuweb:masterfrom
austinEng:abort-error-name
Nov 4, 2019
Merged

kainino0x merged 3 commits into
gpuweb:masterfrom
austinEng:abort-error-name

Conversation

@austinEng

@austinEng austinEng commented Sep 10, 2019 •

Copy link
Copy Markdown
Contributor

According to MDN, AbortError means "The operation was aborted."

When the device is lost, any attempt to popErrorScope is aborted and cannot complete because the device is gone. This is the same DOMException that the:

  • Fetch API uses for aborted requests
  • Payments API uses when the document isn't active anymore
  • Push API uses to terminate a subscription

Preview | Diff

@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.

Makes sense to me, only concern is it's not really technically aborted if the device is already lost. I also don't think the error types really matter to anyone unless there are multiple error types from a single call, so maybe OperationError is sufficient.

@kvark

kvark commented Sep 19, 2019

Copy link
Copy Markdown
Contributor

Is the idea that any device calls would result in AbortError if it's lost?

How is "DeviceLost" conceptually different, from the caller point of view, from an object that is just internally invalid (i.e. a command encoder that just tried to bind and invalid binding, thus it's invalid itself)?

@kainino0x

kainino0x commented Sep 19, 2019 •

Copy link
Copy Markdown
Contributor

Most operations [EDIT: don't] surface an error, except via popErrorScope or unhandlederror. So this case is special relative to most operations. Note that this rejects, not throws an exception.

If a device is lost, even if it's known client-side to be lost, we would expose it by every operation producing an error into the error scope stack, which may bubble out to unhandlederror.

I agree that doing operations while a device is lost should behave approximately the same as doing operations on an object that's invalid.

@kainino0x

Copy link
Copy Markdown
Contributor

F2F resolution: We need to ask someone who knows what AbortError typically means in other specs vs OperationError.

@beaufortfrancois

Copy link
Copy Markdown
Contributor

@domenic or @foolip may help.
What is the differences between AbortError and OperationError?
https://heycam.github.io/webidl/#idl-DOMException-error-names doesn't help much here.

@foolip

foolip commented Oct 6, 2019

Copy link
Copy Markdown
Contributor

Exception types aren't used very consistently and it also doesn't matter too much beyond being able to distinguish failure modes for the same API call that one would handle differently.

@foolip

foolip commented Oct 6, 2019

Copy link
Copy Markdown
Contributor

That being said, it sounds like this exception would be thrown at any time after the device has been lost, and isn't itself signaling that the device was lost, so InvalidStateError might also be a candidate.

@austinEng

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @foolip. Since the rest of the API uses OperationError for most things and there isn't a need (yet) to distinguish between error types for this call, it's seems best if we leave it as OperationError.

@kainino0x

Copy link
Copy Markdown
Contributor

Sounds like we wanted to update this to OperationError. Can you take care of that @austinEng?

Comment thread design/ErrorHandling.md Outdated
Comment thread spec/index.bs Outdated
austinEng and others added 2 commits November 4, 2019 14:33
Co-Authored-By: Justin Fan <jussnf@gmail.com>
Co-Authored-By: Justin Fan <jussnf@gmail.com>
@kainino0x kainino0x changed the title Clarify popErrorScope() rejects with AbortError if the device is lost Clarify popErrorScope() rejects with OperationError if the device is lost Nov 4, 2019
@kainino0x
kainino0x merged commit c269466 into gpuweb:master Nov 4, 2019
aarongable pushed a commit to chromium/chromium that referenced this pull request Nov 5, 2019
The popErrorScope() was changed to reject with an OperationError if the
GPUDevice is lost[1]. So, this patch matches up with the spec. Also,
although the spec doesn't mention it yet, we should make it throw an
OperationError for all cases where the device is lost.

[1] gpuweb/gpuweb#433

Bug: 852089
Change-Id: I3a80b5e741e1ea831fd92aa2eb3dcdafd6bc740e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898891
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712587}
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
* Organize more and add more test stubs

* address comments, edit a tiny bit more
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