From 0e1f330720dd5adb331b13a72b4b0904bd2ba91b Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 4 Dec 2020 09:59:54 +1000 Subject: [PATCH] Use error message derives in zebra-state Rather than displaydoc. --- zebra-state/src/error.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zebra-state/src/error.rs b/zebra-state/src/error.rs index 7a8ff794e..e6838dacd 100644 --- a/zebra-state/src/error.rs +++ b/zebra-state/src/error.rs @@ -36,39 +36,39 @@ pub type BoxError = Box; pub struct CommitBlockError(#[from] ValidateContextError); /// An error describing why a block failed contextual validation. -#[derive(displaydoc::Display, Debug, Error)] +#[derive(Debug, Error)] #[non_exhaustive] #[allow(missing_docs)] pub enum ValidateContextError { - /// block height {candidate_height:?} is lower than the current finalized height {finalized_tip_height:?} + #[error("block height {candidate_height:?} is lower than the current finalized height {finalized_tip_height:?}")] #[non_exhaustive] OrphanedBlock { candidate_height: block::Height, finalized_tip_height: block::Height, }, - /// block height {candidate_height:?} is not one greater than its parent block's height {parent_height:?} + #[error("block height {candidate_height:?} is not one greater than its parent block's height {parent_height:?}")] #[non_exhaustive] NonSequentialBlock { candidate_height: block::Height, parent_height: block::Height, }, - /// block time {candidate_time:?} is less than or equal to the median-time-past for the block {median_time_past:?} + #[error("block time {candidate_time:?} is less than or equal to the median-time-past for the block {median_time_past:?}")] #[non_exhaustive] TimeTooEarly { candidate_time: DateTime, median_time_past: DateTime, }, - /// block time {candidate_time:?} is greater than the median-time-past for the block plus 90 minutes {block_time_max:?} + #[error("block time {candidate_time:?} is greater than the median-time-past for the block plus 90 minutes {block_time_max:?}")] #[non_exhaustive] TimeTooLate { candidate_time: DateTime, block_time_max: DateTime, }, - /// block difficulty threshold {difficulty_threshold:?} is not equal to the expected difficulty for the block {expected_difficulty:?} + #[error("block difficulty threshold {difficulty_threshold:?} is not equal to the expected difficulty for the block {expected_difficulty:?}")] #[non_exhaustive] InvalidDifficultyThreshold { difficulty_threshold: CompactDifficulty,