Skip to content

Commit d77416c

Browse files
committed
error: Unimplement Error::source
In error types that wrap an underlying error, the underlying error should either be returned by the outer error's source, or rendered by the outer error's Display implementation, but not both. ref: <https://doc.rust-lang.org/std/error/trait.Error.html#error-source>
1 parent 06526db commit d77416c

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

src/error.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,7 @@ impl fmt::Display for Error {
6767
}
6868
}
6969

70-
impl std::error::Error for Error {
71-
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
72-
match self {
73-
Error::DecodeHex(e) => Some(e),
74-
Error::JsonRpc(e) => Some(e),
75-
Error::HexToArray(e) => Some(e),
76-
Error::Json(e) => Some(e),
77-
Error::Io(e) => Some(e),
78-
Error::TryFromInt(e) => Some(e),
79-
Error::GetBlockVerboseOne(e) => Some(e),
80-
Error::GetBlockHeaderVerbose(e) => Some(e),
81-
Error::GetBlockFilter(e) => Some(e),
82-
_ => None,
83-
}
84-
}
85-
}
70+
impl std::error::Error for Error {}
8671

8772
// Conversions from other error types
8873
impl From<jsonrpc::Error> for Error {

0 commit comments

Comments
 (0)