webgpu-native / webgpu-headers

**NOT STABLE YET!** See README.
https://webgpu-native.github.io/webgpu-headers/
BSD 3-Clause "New" or "Revised" License
394 stars 45 forks source link

popErrorScope status when stack is empty? #369

Closed kainino0x closed 6 days ago

kainino0x commented 1 month ago

In JS when the error scope stack is empty, popErrorScope rejects with OperationError. What should we do in C?

Emscripten and Dawn currently translate it to Unknown plus a message string. However we also use Unknown in Emscripten if the error type is some unexpected object (e.g. if we add one to the JS API in the future).

We should also say what the message string is. I think it must be empty if the status is NoError and it should be non-empty for any other status. (since message can't be null anymore)

lokokung commented 1 month ago

Hmm, that's a good point. In C, there's only Success and InstanceDropped on WGPUPopErrorScopeStatus. Maybe we could add another case there instead of modifying the error type?

kainino0x commented 3 weeks ago

You're right, using the status makes more sense. Also, we shouldn't add it to WGPUErrorType, since that's also used in WGPUUncapturedErrorCallback.

We have to decide what values you get when the status is something other than Success.

The first half of this seems pretty trivial so I'm going to just open a PR for it.

kainino0x commented 3 weeks ago

It should not be Unknown because that value implies there will be a message string.

EDIT: ... unless we want to pass a message string when the stack is empty, for some reason?

kainino0x commented 2 weeks ago

Tentatively closing as I did my proposal in #393, but leaving the label to discuss if we want to reopen.

kainino0x commented 1 week ago

Nov 21 meeting: