Minor fix to Dawn Node to reject promise on failure

Prior to this change we were seeing:
EXCEPTION: Error: There was an extra error scope
           on the stack after a test

Change-Id: Idb651b998f09b93247b306a7042eedb077e39643
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/237454
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Peter McNeeley <petermcneeley@google.com>
diff --git a/src/dawn/node/binding/GPUDevice.cpp b/src/dawn/node/binding/GPUDevice.cpp
index ebef52b..44a10d8 100644
--- a/src/dawn/node/binding/GPUDevice.cpp
+++ b/src/dawn/node/binding/GPUDevice.cpp
@@ -546,9 +546,14 @@
 
     device_.PopErrorScope(
         wgpu::CallbackMode::AllowProcessEvents,
-        [ctx = std::move(ctx)](wgpu::PopErrorScopeStatus, wgpu::ErrorType type,
+        [ctx = std::move(ctx)](wgpu::PopErrorScopeStatus status, wgpu::ErrorType type,
                                wgpu::StringView message) {
             auto env = ctx->env;
+            if (status != wgpu::PopErrorScopeStatus::Success) {
+                ctx->promise.Reject(Errors::OperationError(env, std::string(message)));
+                return;
+            }
+
             switch (type) {
                 case wgpu::ErrorType::NoError:
                     ctx->promise.Resolve({});