dawn.node: make popErrorScope reject on validation errors.
The semantic of popErrorScope was changed from raising an exception on validation errors to instead reject the promise. Bug: dawn:1123 Bug: dawn:1324 Change-Id: I34322d8293e112eb2d1bfea784e2b2d6be33b604 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85506 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
d78ca49bdb
commit
d1cdb61aa1
|
@ -454,7 +454,7 @@ namespace wgpu::binding {
|
|||
auto* ctx = new Context{env, Promise(env, PROMISE_INFO), async_};
|
||||
auto promise = ctx->promise;
|
||||
|
||||
bool ok = device_.PopErrorScope(
|
||||
device_.PopErrorScope(
|
||||
[](WGPUErrorType type, char const* message, void* userdata) {
|
||||
auto c = std::unique_ptr<Context>(static_cast<Context*>(userdata));
|
||||
auto env = c->env;
|
||||
|
@ -465,12 +465,14 @@ namespace wgpu::binding {
|
|||
case WGPUErrorType::WGPUErrorType_OutOfMemory:
|
||||
c->promise.Resolve(interop::GPUOutOfMemoryError::Create<OOMError>(env));
|
||||
break;
|
||||
case WGPUErrorType::WGPUErrorType_Unknown:
|
||||
case WGPUErrorType::WGPUErrorType_DeviceLost:
|
||||
case WGPUErrorType::WGPUErrorType_Validation:
|
||||
c->promise.Resolve(
|
||||
interop::GPUValidationError::Create<ValidationError>(env, message));
|
||||
break;
|
||||
case WGPUErrorType::WGPUErrorType_Unknown:
|
||||
case WGPUErrorType::WGPUErrorType_DeviceLost:
|
||||
c->promise.Reject(Errors::OperationError(env, message));
|
||||
break;
|
||||
default:
|
||||
c->promise.Reject("unhandled error type");
|
||||
break;
|
||||
|
@ -478,12 +480,6 @@ namespace wgpu::binding {
|
|||
},
|
||||
ctx);
|
||||
|
||||
if (ok) {
|
||||
return promise;
|
||||
}
|
||||
|
||||
delete ctx;
|
||||
promise.Reject(Errors::OperationError(env));
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue