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
asyncfnpost_data(user:&mutGooseUser) -> TransactionResult{#[derive(Serialize)]#[serde(rename_all = "camelCase")]structJson{data:Data,}let json = Json{data:Data{// omitted},};letmut goose = user
.post_json("my/url",&json).await?;let res = goose.response?;}
then:
> cargo +nightly check
Checking myapp v0.1.0 (/path/to/my/app)
error[E0277]: `?` couldn't convert the error to `Box<TransactionError>`
--> /path/to/my/app/src/main.rs:42:42
|
42 | let res = goose.response?;
| ^ the trait `From<reqwest::error::Error>` is not implemented for `Box<TransactionError>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
<Box<(dyn StdError + 'a)> as From<E>>
<Box<(dyn StdError + 'static)> as From<&str>>
<Box<(dyn StdError + 'static)> as From<Cow<'a, str>>>
<Box<(dyn StdError + 'static)> as From<std::string::String>>
<Box<(dyn StdError + Send + Sync + 'a)> as From<&str>>
<Box<(dyn StdError + Send + Sync + 'a)> as From<Cow<'b, str>>>
<Box<(dyn StdError + Send + Sync + 'a)> as From<E>>
<Box<(dyn StdError + Send + Sync + 'static)> as From<std::string::String>>
and 18 others
= note: required for `Result<(), Box<TransactionError>>` to implement `FromResidual<Result<Infallible, reqwest::error::Error>>`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `myapp` due to previous error
a quick fix is to wrap the error into a Box:
// line 42let res = goose.response.map_err(|e| Box::new(TransactionError::Reqwest(e)))?;
The text was updated successfully, but these errors were encountered:
minimal repeatable code snippet:
then:
a quick fix is to wrap the error into a
Box
:The text was updated successfully, but these errors were encountered: