Return generic error as Some
The `std::error::Error` impl for `consensus::DecodeError` should return the inner generic error.
This commit is contained in:
parent
a6254212dc
commit
ebfef3f114
|
@ -38,14 +38,14 @@ impl<E: fmt::Debug> fmt::Display for DecodeError<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[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)> {
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||||
use DecodeError::*;
|
use DecodeError::*;
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
TooManyBytes => None,
|
TooManyBytes => None,
|
||||||
Consensus(ref e) => Some(e),
|
Consensus(ref e) => Some(e),
|
||||||
Other(_) => None, // TODO: Is this correct?
|
Other(ref e) => Some(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue