Skip to content

Commit 34fc5eb

Browse files
authored
Revert "remove deprecated description for TrieError (#85)" (#86)
This reverts commit bc8a83f.
1 parent bc8a83f commit 34fc5eb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

trie-db/src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ impl<T, E> fmt::Display for TrieError<T, E> where T: MaybeDebug, E: MaybeDebug {
121121
}
122122
}
123123

124+
#[cfg(feature = "std")]
125+
impl<T, E> Error for TrieError<T, E> where T: fmt::Debug, E: Error {
126+
fn description(&self) -> &str {
127+
match *self {
128+
TrieError::InvalidStateRoot(_) => "Invalid state root",
129+
TrieError::IncompleteDatabase(_) => "Incomplete database",
130+
TrieError::ValueAtIncompleteKey(_, _) => "Value at incomplete key",
131+
TrieError::DecoderError(_, ref err) => err.description(),
132+
TrieError::InvalidHash(_, _) => "Encoded node contains invalid hash reference",
133+
}
134+
}
135+
}
136+
124137
/// Trie result type.
125138
/// Boxed to avoid copying around extra space for the `Hasher`s `Out` on successful queries.
126139
pub type Result<T, H, E> = crate::rstd::result::Result<T, Box<TrieError<H, E>>>;

0 commit comments

Comments
 (0)