From 58e76098e6325ad16d552924d58c33bad6573c07 Mon Sep 17 00:00:00 2001 From: Geert-Jan Zwiers Date: Thu, 1 Sep 2022 22:20:11 +0200 Subject: fix(serde_v8): no panic on reading large text file (#15494) Co-authored-by: Nayeem Rahman --- core/runtime.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/runtime.rs b/core/runtime.rs index 47777099c..d640e3e04 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1946,7 +1946,12 @@ impl JsRuntime { for (promise_id, mut resp) in results.into_iter() { args.push(v8::Integer::new(scope, promise_id).into()); - args.push(resp.to_v8(scope).unwrap()); + args.push(match resp.to_v8(scope) { + Ok(v) => v, + Err(e) => OpResult::Err(OpError::new(&|_| "TypeError", e.into())) + .to_v8(scope) + .unwrap(), + }); } let tc_scope = &mut v8::TryCatch::new(scope); -- cgit v1.2.3