You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
future_to_promise: accept JsError instead of anyhow::Error
`future_to_promise` is responsible for taking the `Future`s that result from
running rust code, and wrapping them into javascript Promises. Currently, it
takes a `Result<T, anyhow::Error>`, meaning that all our errors get
wrapped into `anyhow::Error`; `future_to_promise` then converts that
`anyhow::Error` into a `JsError`.
However:
1. This doesn't work terribly well under matrix-rust-sdk 0.12.0, because some
of our error types no longer implement `Send + Sync`, which means that
`anyhow::Error::from()` will no longer accept them.
2. It's redundant anyway. It turns out that almost all of the async blocks we
pass to `future_to_promise` are just as happy to directly return a
`JsError`, thus cutting out the middleman. And
`JsError::from(std::error::Error)` doesn't require that the error be `Send
+ Sync`.
The only remaining exception is in `verification.rs`, which is soon fixed up.
0 commit comments