diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2022-03-19 15:59:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-19 15:59:44 +0100 |
commit | 52459faf0b35ed157bb640d24c6107e1ff00aded (patch) | |
tree | 1ff10d2d4188861e4b4aafd3d92f562ce6c1fdb0 /ops/lib.rs | |
parent | 52a6e9ef4ad63c06504867d60a44840c62b7a0cd (diff) |
fix(ops): throw TypeError on op return failure (#14033)
Fixes #14028
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 49057507d..4a24b6e33 100644 --- a/ops/lib.rs +++ b/ops/lib.rs @@ -260,8 +260,13 @@ fn codegen_sync_ret( quote! {} } else { quote! { - let ret = #core::serde_v8::to_v8(scope, v).unwrap(); - rv.set(ret); + match #core::serde_v8::to_v8(scope, v) { + Ok(ret) => rv.set(ret), + Err(err) => #core::_ops::throw_type_error( + scope, + format!("Error serializing return: {}", #core::anyhow::Error::from(err)), + ), + }; } }; |