Return generic error as Some

The `std::error::Error` impl for `consensus::DecodeError` should return
the inner generic error.
This commit is contained in:
Tobin C. Harding 2024-10-18 09:58:41 +11:00
parent a6254212dc
commit ebfef3f114
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -38,14 +38,14 @@ impl<E: fmt::Debug> fmt::Display for DecodeError<E> {
}
#[cfg(feature = "std")]
impl<E: fmt::Debug> std::error::Error for DecodeError<E> {
impl<E: fmt::Debug + std::error::Error + 'static> std::error::Error for DecodeError<E> {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use DecodeError::*;
match *self {
TooManyBytes => None,
Consensus(ref e) => Some(e),
Other(_) => None, // TODO: Is this correct?
Other(ref e) => Some(e),
}
}
}