Closed kainino0x closed 6 days 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?
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
.
WGPUStringView message
is empty stringWGPUErrorType type
is... NoError=1
? ~Unknown=5
?~ Add a new Undefined=0
and return that? Renumber NoError
to 0
? Rename NoError=1
to Undefined=0
and return that?The first half of this seems pretty trivial so I'm going to just open a PR for it.
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?
Tentatively closing as I did my proposal in #393, but leaving the label to discuss if we want to reopen.
Nov 21 meeting:
WGPUPopErrorScopeStatus_EmptyStack
(in addition to Success
and InstanceDropped
.
WGPUErrorType
, that's also used in WGPUUncapturedErrorCallback
)EmptyStack
or InstanceDropped
, what should WGPUErrorType type
be? I tentatively said NoError
since that matches with message
being empty string.
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 useUnknown
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)