diff options
author | Geert-Jan Zwiers <geertjanzwiers@protonmail.com> | 2022-09-01 22:20:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 22:20:11 +0200 |
commit | 58e76098e6325ad16d552924d58c33bad6573c07 (patch) | |
tree | fe4016ce33c45fb3649504e072677f2dba9e2fcd /core | |
parent | 778eb1da24ac77635ffbc24e05e826bca973199b (diff) |
fix(serde_v8): no panic on reading large text file (#15494)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/runtime.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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); |