Use explicit error::Error impl instead of the default

In a further effort to make the code brain-dead easy to read; use an
explicit implementation of `std::error::Error` that returns `None`
instead of relying on the default trait implementation.
This commit is contained in:
Tobin C. Harding 2023-10-04 13:01:43 +11:00
parent 2512dbafc2
commit 43d3306822
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
4 changed files with 18 additions and 6 deletions

View File

@ -329,7 +329,9 @@ impl fmt::Display for TxIndexOutOfRangeError {
}
#[cfg(feature = "std")]
impl error::Error for TxIndexOutOfRangeError {}
impl error::Error for TxIndexOutOfRangeError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
/// A [BlockTransactions] structure is used to provide some of the transactions
/// in a block, as requested.

View File

@ -637,7 +637,9 @@ impl fmt::Display for ConversionError {
}
#[cfg(feature = "std")]
impl std::error::Error for ConversionError {}
impl std::error::Error for ConversionError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
/// Describes the two types of locking, lock-by-blockheight and lock-by-blocktime.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@ -679,7 +681,9 @@ impl fmt::Display for OperationError {
}
#[cfg(feature = "std")]
impl std::error::Error for OperationError {}
impl std::error::Error for OperationError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
#[cfg(test)]
mod tests {

View File

@ -717,7 +717,9 @@ impl fmt::Display for TryFromError {
}
#[cfg(feature = "std")]
impl std::error::Error for TryFromError {}
impl std::error::Error for TryFromError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
impl Add for U256 {
type Output = Self;

View File

@ -890,7 +890,9 @@ impl fmt::Display for ExtractTxError {
}
#[cfg(feature = "std")]
impl std::error::Error for ExtractTxError {}
impl std::error::Error for ExtractTxError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
/// Input index out of bounds (actual index, maximum index allowed).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -931,7 +933,9 @@ impl fmt::Display for IndexOutOfBoundsError {
}
#[cfg(feature = "std")]
impl std::error::Error for IndexOutOfBoundsError {}
impl std::error::Error for IndexOutOfBoundsError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
#[cfg(feature = "base64")]
mod display_from_str {