Skip to content
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

the trait bound serde_json::Error: ResponseError is not satisfied #183

Closed
shanliu opened this issue Apr 30, 2021 · 6 comments · Fixed by #188
Closed

the trait bound serde_json::Error: ResponseError is not satisfied #183

shanliu opened this issue Apr 30, 2021 · 6 comments · Fixed by #188

Comments

@shanliu
Copy link

shanliu commented Apr 30, 2021

error[E0277]: the trait bound `serde_json::Error: ResponseError` is not satisfied
   --> C:\Users\PC\.cargo\registry\src\github.com-1ecc6299db9ec823\actix-session-0.5.0-beta.1\src/lib.rs:151:44
    |
151 |             Ok(Some(serde_json::from_str(s)?))
    |                                            ^ the trait `ResponseError` is not implemented for `serde_json::Error`
    |
    = note: required because of the requirements on the impl of `From<serde_json::Error>` for `actix_web::Error`
    = note: required by `std::convert::From::from`

Your Environment

OS Name: Microsoft Windows 10
OS Version: 10.0.19042 N/A Build 19042

  • Rust Version (I.e, output of rustc -V):
    rustc 1.53.0-nightly (7f4afdf02 2021-04-22)
    actix-web = "~4.0.0-beta.6"
    actix-session = "0.5.0-beta.1"
@miraclx
Copy link

miraclx commented May 1, 2021

Since actix-http 4.0.0-beta.6 (actix/actix-web#2148), ResponseError is no longer impl for serde_json::Error

You can go ahead to map and wrap that Error:

+ use actix_web::error::JsonPayloadError;
+
- Ok(Some(serde_json::from_str(s)?))
+ Ok(Some(serde_json::from_str(s).map_err(JsonPayloadError::Deserialize)?))

Also see: Cargo.toml's [patch] section

@shanliu
Copy link
Author

shanliu commented May 6, 2021

Since actix-http 4.0.0-beta.6 (actix/actix-web#2148), ResponseError is no longer impl for serde_json::Error

You can go ahead to map and wrap that Error:

+ use actix_web::error::JsonPayloadError;
+
- Ok(Some(serde_json::from_str(s)?))
+ Ok(Some(serde_json::from_str(s).map_err(JsonPayloadError::Deserialize)?))

Also see: Cargo.toml's [patch] section

actix-session crate error..

@miraclx
Copy link

miraclx commented May 6, 2021

Mind including the error?

@shanliu

This comment has been minimized.

@JohnTitor
Copy link
Member

Please refrain from using offensive words.
Note that it's a beta version and syncing the actix-* crates are hard to maintain (in particular, it's on the actix-extras repo).

@nalpr
Copy link

nalpr commented Jun 20, 2021

you should stick to
actix-service = "=2.0.0-beta.5"
actix-web = "=4.0.0-beta.5"
a bit longer and wait for new versions.

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

Successfully merging a pull request may close this issue.

4 participants