Skip to content

Allow using ? with Result<T, JsValue> in functions that return Result<S, Box<dyn std::error::Error>> #2994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
casey opened this issue Jul 14, 2022 · 0 comments

Comments

@casey
Copy link

casey commented Jul 14, 2022

Motivation

For quick and dirty error handling, it's often nice to use Box<dyn std::error::Error>. This doesn't work well with wasm-bindgen, however, because JsValue doesn't implement std::error::Error

Proposed Solution

Implement std::error::Error for JsValue. Although JsValue might not always be an error, it is wasm-bindgen's error type.

Alternatives

Do nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant