mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-15 05:51:23 +00:00
js-sys: Catch exceptions thrown in Reflect APIs
Proxies passed to Reflect APIs can throw for any of these operations and it is a bit of a mess.
This commit is contained in:
@ -72,7 +72,7 @@ fn stringify() {
|
||||
fn stringify_error() {
|
||||
let func = Function::new_no_args("throw new Error(\"rust really rocks\")");
|
||||
let obj = Object::new();
|
||||
Reflect::set(obj.as_ref(), &JsValue::from("toJSON"), func.as_ref());
|
||||
Reflect::set(obj.as_ref(), &JsValue::from("toJSON"), func.as_ref()).unwrap();
|
||||
|
||||
let result = JSON::stringify(&JsValue::from(obj));
|
||||
assert!(result.is_err());
|
||||
|
Reference in New Issue
Block a user