Responder
Trait for diesel::result::Error
not satisfied
#2163
-
I wrote an error-enum to help me use the
I'm not quite sure what to do. I'm unable to impl or derive Rust-code: use std::{
error::Error,
fmt::{self, Display, Formatter},
result::Result,
};
pub type HandlerResult<T> = Result<T, HandlerError>;
#[derive(Debug, Responder)]
#[response(status = 500, content_type = "json")]
pub enum HandlerError {
//#[response(status = 500, content_type = "json")]
Validation(validator::ValidationError),
Diesel(diesel::result::Error),
Io(std::io::Error),
Text(String),
}
impl Error for HandlerError {}
impl Display for HandlerError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{}", self)
}
} I also receive this error, but I suspect it has more to do with
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
My dependencies: chrono = { version = "0.4.19", features = ["serde"] }
diesel = { version = "1.4.8", features = ["postgres", "chrono", "serde_json"] }
okapi = "0.7.0-rc.1"
rand = "0.8.5"
rocket = { version = "0.5.0-rc.1", features = ["json"] }
rocket_okapi = { version = "0.8.0-rc.1", features = ["swagger"] }
schemars = { version = "0.8.8", features = ["chrono"] }
serde = { version = "^1.0", features = ["derive"] }
validator = { version = "0.15", features = ["derive"] } |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what you want to do, exactly, but perhaps the |
Beta Was this translation helpful? Give feedback.
-
To close this discussion: Turns out what I needed to do is manually implement the |
Beta Was this translation helpful? Give feedback.
To close this discussion: Turns out what I needed to do is manually implement the
Responder
-trait for each of the Errors: