jameysharp commented on issue #6782:
Thanks for suggesting an improvement to error reporting! But I'm confused by this change.
.with_contextis supposed to add context to the error, not replace it. So the message ine.to_string()should already be available from the returned error. See the documentation onanyhow::Context.I suspect if you didn't see the "Caused by:" chain in the error output, then the root issue here is that something is not printing errors in the right way. Can you provide more information about what you tried and what output you got?
zarkone commented on issue #6782:
@jameysharp you are right, thank you! That was not obvious to me. Sorry for rubberducking you instead of reading the docs >..<
For the context (pun intended),
anyhow::Contextprints onlycontextpart of error usingDisplayprinter{}. In order to print full info, including "source",{:#}should be used.https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations
zarkone edited a comment on issue #6782:
@jameysharp you are right, thank you! That was not obvious to me. Sorry for rubberducking you instead of reading the docs >..<
For the context (pun intended),
anyhow::Errorprints onlycontextpart of error usingDisplayprinter{}. In order to print full info, including "source",{:#}should be used.https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations
Last updated: Dec 13 2025 at 19:03 UTC