diff options
Diffstat (limited to 'ops/lib.rs')
-rw-r--r-- | ops/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ops/lib.rs b/ops/lib.rs index df8abf61e..fdafca165 100644 --- a/ops/lib.rs +++ b/ops/lib.rs @@ -190,7 +190,7 @@ fn codegen_v8_async( quote! { let result = match result { Ok(fut) => fut.await, - Err(e) => return (promise_id, op_id, #core::_ops::to_op_result::<()>(get_class, Err(e))), + Err(e) => return (context, promise_id, op_id, #core::_ops::to_op_result::<()>(get_class, Err(e))), }; } } else { @@ -233,11 +233,16 @@ fn codegen_v8_async( state.get_error_class_fn }; + let context = { + let local = scope.get_current_context(); + #core::v8::Global::new(scope, local) + }; + #pre_result #core::_ops::queue_async_op(scope, async move { let result = #result_fut #result_wrapper - (promise_id, op_id, #core::_ops::to_op_result(get_class, result)) + (context, promise_id, op_id, #core::_ops::to_op_result(get_class, result)) }); } } |