Skip to content

Commit e98f749

Browse files
committed
Implement StdError::source for ResponseError
1 parent 47c9a57 commit e98f749

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

payjoin/src/send/error.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,17 @@ impl ResponseError {
305305
}
306306
}
307307

308-
impl std::error::Error for ResponseError {}
308+
impl std::error::Error for ResponseError {
309+
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
310+
use ResponseError::*;
311+
312+
match self {
313+
WellKnown(error) => Some(error),
314+
Validation(error) => Some(error),
315+
Unrecognized { .. } => None,
316+
}
317+
}
318+
}
309319

310320
impl From<WellKnownError> for ResponseError {
311321
fn from(value: WellKnownError) -> Self { Self::WellKnown(value) }

0 commit comments

Comments
 (0)