Block error display (#1503)

## Issue Addressed

#1486
This commit is contained in:
divma
2020-08-11 01:30:26 +00:00
parent 134676fd6f
commit 95b55d7170
2 changed files with 14 additions and 4 deletions

View File

@@ -199,6 +199,17 @@ pub enum BlockError<T: EthSpec> {
BeaconChainError(BeaconChainError),
}
impl<T: EthSpec> std::fmt::Display for BlockError<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
BlockError::ParentUnknown(block) => {
write!(f, "ParentUnknown(parent_root:{})", block.parent_root())
}
other => write!(f, "{:?}", other),
}
}
}
impl<T: EthSpec> From<BlockSignatureVerifierError> for BlockError<T> {
fn from(e: BlockSignatureVerifierError) -> Self {
match e {