If you're not familiar with the tracing
crate, give the instrument
page a read. You may find the #[instrument(err)]
part particularly useful.
As for the errors themselves, if you're using thiserror
(you should be), then the variants in your error enum would/should contain the relevant context data. And the chain of errors would be tracked via source
/#[source]
fields, as explained in the crate docs. You can see such chains if you use anyhow
in your application code.