Skip to content

Commit

Permalink
Merge pull request #24 from m4tx/master
Browse files Browse the repository at this point in the history
Delegate source() in OverlayError's Error impl
  • Loading branch information
leotaku authored Jan 15, 2025
2 parents 0befa57 + b37c5c9 commit 106cc96
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,14 @@ pub enum OverlayError<A, B> {
B(B),
}

impl<A: std::error::Error, B: std::error::Error> std::error::Error for OverlayError<A, B> {}
impl<A: std::error::Error, B: std::error::Error> std::error::Error for OverlayError<A, B> {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
OverlayError::A(a) => a.source(),
OverlayError::B(b) => b.source(),
}
}
}

impl<A: Display, B: Display> Display for OverlayError<A, B> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down

0 comments on commit 106cc96

Please sign in to comment.