Skip to content

Commit 4876ceb

Browse files
authored
signature: show error source in Display impl (#791)
Previously the `Display` impl on `Error` didn't include source information if available. This change displays it if available.
1 parent d2639c1 commit 4876ceb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

signature/src/error.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ impl Debug for Error {
7878

7979
impl Display for Error {
8080
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
81-
f.write_str("signature error")
81+
f.write_str("signature error")?;
82+
83+
#[cfg(feature = "std")]
84+
{
85+
if let Some(source) = &self.source {
86+
write!(f, ": {}", source)?;
87+
}
88+
}
89+
90+
Ok(())
8291
}
8392
}
8493

0 commit comments

Comments
 (0)