Description
Describe the Bug
The library I'm calling (sqlite3.js) returns an object with "type": "Error" instead of an instance of Error or a String. Calling try_from panics because the fallback case calls JsString::from which panics if the type is wrong. It should probably call try_from and fallback to calling fmt::Debug or similar in the non-string case. I can work around it but the try_from panicking seems unexpected.
Here is the relevant line:
gloo/crates/utils/src/errors.rs
Line 55 in dc0e61e
Steps to Reproduce
Reject a promise with an object and call JsError::try_from on the resulting JsValue.
Expected Behavior
I don't think try_from should ever panic. Making the string on NotJsError optional or making the error type an enum would make more sense to me.
Actual Behavior
Panics in JsString::from with "unwrap_throw failed".