-
-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Description
I'm trying to convert a Arc<Error> (returned by moka crate) to an Error
So what i basically do is
moka().map_err(|e| anyhow::anyhow!(e))?But doing this, i lose information, before the map_err, printing with {:#} give me all the chained errors, but after the map_err, i get only the last one.
I've reproduced issue with the following code
let error1 = anyhow::Error::msg("error1");
let error2 = anyhow::Error::from(error1).context("error2");
println!("error 2 '{:#}'", error2);
println!("error 2 src '{:?}'", error2.source());is printing
error 2 'error2: error1'
error 2 src 'Some("error1")'
Recreating an error from error2 still works
let error_from_error = anyhow::anyhow!(error2);But if i try to do this this an Arc
let arc_error = std::sync::Arc::new(error2);
let error_from_arc = anyhow::anyhow!(arc_error);
println!("src '{:?}'", error_from_arc.source());
println!("error_from_arc '{:#}'", error_from_arc);is printing
src 'None'
error_from_arc 'error2'
But
println!("error_from_arc '{:#?}'", error_from_arc);is printing
error_from_arc 'Error {
context: "error2",
source: "error1",
}'
ouillie and nnmm
Metadata
Metadata
Assignees
Labels
No labels