diff --git a/crates/utils/src/errors.rs b/crates/utils/src/errors.rs index 9d9eb51f..c93ee104 100644 --- a/crates/utils/src/errors.rs +++ b/crates/utils/src/errors.rs @@ -52,7 +52,13 @@ impl TryFrom for JsError { match value.dyn_into::() { Ok(error) => Ok(JsError::from(error)), Err(js_value) => { - let js_to_string = String::from(js_sys::JsString::from(js_value.clone())); + let js_to_string = js_value + .clone() + .dyn_into::() + .map(String::from) + .unwrap_or_else(|_| { + String::from("js_value passed has no string representation") + }); Err(NotJsError { js_value, js_to_string,