From b870a4ef01fb5d59665844919c5a507e10278820 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Wed, 20 Sep 2023 23:39:10 +0200 Subject: [PATCH] feat(interfaces): better document `BlockchainTreeError` (#4693) --- .../interfaces/src/blockchain_tree/error.rs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/crates/interfaces/src/blockchain_tree/error.rs b/crates/interfaces/src/blockchain_tree/error.rs index c5c3399f2..33872b952 100644 --- a/crates/interfaces/src/blockchain_tree/error.rs +++ b/crates/interfaces/src/blockchain_tree/error.rs @@ -22,15 +22,30 @@ pub enum BlockchainTreeError { /// The internal identifier for the side chain. chain_id: u64, }, + /// Thrown if a canonical chain header cannot be found. #[error("Canonical chain header #{block_hash} can't be found ")] - CanonicalChain { block_hash: BlockHash }, + CanonicalChain { + /// The block hash of the missing canonical chain header. + block_hash: BlockHash, + }, + /// Thrown if a block number cannot be found in the blockchain tree chain. #[error("Block number #{block_number} not found in blockchain tree chain")] - BlockNumberNotFoundInChain { block_number: BlockNumber }, + BlockNumberNotFoundInChain { + /// The block number that could not be found. + block_number: BlockNumber, + }, + /// Thrown if a block hash cannot be found in the blockchain tree chain. #[error("Block hash {block_hash} not found in blockchain tree chain")] - BlockHashNotFoundInChain { block_hash: BlockHash }, + BlockHashNotFoundInChain { + /// The block hash that could not be found. + block_hash: BlockHash, + }, // Thrown if the block failed to buffer #[error("Block with hash {block_hash:?} failed to buffer")] - BlockBufferingFailed { block_hash: BlockHash }, + BlockBufferingFailed { + /// The block hash of the block that failed to buffer. + block_hash: BlockHash, + }, } /// Result alias for `CanonicalError`