diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-04-27 13:40:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 14:40:03 +0200 |
commit | 03132e19da6c8e34e8100c6a57cd911b43900950 (patch) | |
tree | 014db77ed12f9ae882abba3c23c5f541461f03b4 /cli/tools/bench.rs | |
parent | d043a6d72cbf683c70f7eb4b9b3c09003afd2683 (diff) |
fix(test): handle dispatched exceptions from test functions (#18853)
Fixes #18852.
Diffstat (limited to 'cli/tools/bench.rs')
-rw-r--r-- | cli/tools/bench.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs index 962b1ac17..5f467bc6e 100644 --- a/cli/tools/bench.rs +++ b/cli/tools/bench.rs @@ -489,14 +489,7 @@ async fn bench_specifier( }))?; for (desc, function) in benchmarks { sender.send(BenchEvent::Wait(desc.id))?; - let promise = { - let scope = &mut worker.js_runtime.handle_scope(); - let cb = function.open(scope); - let this = v8::undefined(scope).into(); - let promise = cb.call(scope, this, &[]).unwrap(); - v8::Global::new(scope, promise) - }; - let result = worker.js_runtime.resolve_value(promise).await?; + let result = worker.js_runtime.call_and_await(&function).await?; let scope = &mut worker.js_runtime.handle_scope(); let result = v8::Local::new(scope, result); let result = serde_v8::from_v8::<BenchResult>(scope, result)?; |