mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-28 05:21:34 +00:00
Implement alternate debug format {:#?}
This commit is contained in:
parent
d324d628f3
commit
cba8b1fb47
@ -102,7 +102,10 @@ where
|
||||
E: Debug,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}\nCaused by: {:?}", self.context, self.error)
|
||||
f.debug_struct("Error")
|
||||
.field("context", &self.context.to_string())
|
||||
.field("source", &self.error)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -678,6 +678,10 @@ impl ErrorImpl<()> {
|
||||
}
|
||||
|
||||
fn debug(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if f.alternate() {
|
||||
return Debug::fmt(self.error(), f);
|
||||
}
|
||||
|
||||
writeln!(f, "{}", self.error())?;
|
||||
|
||||
let mut chain = self.chain().skip(1).enumerate().peekable();
|
||||
|
Loading…
x
Reference in New Issue
Block a user