Skip to content

error-stack with actix-web integration #952

Discussion options

You must be logged in to vote

Hi @sergiupopescu199,

This is a good question, and also thank you very much for providing a minimal reproducible example, this is really helpful!

The error is slightly hidden in the error message:

= note: required because of the requirements on the impl of std::convert::From<error_stack::Report<ServerError>> for actix_web::Error

as you are actually expecting it to be std::convert::From<ServerError>.

The definition of anyhow::Result and error_stack::Result is slightly different. For anyhow, this is defined as

pub type Result<T, E = anyhow::Error> = Result<T, E>;

but for error_stack, this is defined as

pub type Result<T, C> = Result<T, Report<C>>;

this means, that your function is defined…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@sergiupopescu199
Comment options

@TimDiekmann
Comment options

@sergiupopescu199
Comment options

@TimDiekmann
Comment options

Answer selected by sergiupopescu199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area)
2 participants