mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 12:48:00 +00:00
error rework, for polkadot convenience (#7446)
Co-authored-by: Bernhard Schuster <bernhard@parity.io> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1679919830
commit
9687759774
@@ -30,27 +30,25 @@ type BlockNumber = Option<u128>;
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Error type.
|
||||
#[derive(Debug, derive_more::Display)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
/// Proposal provided not a block.
|
||||
#[display(fmt="Proposal provided not a block: decoding error: {}", _0)]
|
||||
BadProposalFormat(codec::Error),
|
||||
#[error("Proposal provided not a block: decoding error: {0}")]
|
||||
BadProposalFormat(#[from] codec::Error),
|
||||
/// Proposal had wrong parent hash.
|
||||
#[display(fmt="Proposal had wrong parent hash. Expected {:?}, got {:?}", expected, got)]
|
||||
#[error("Proposal had wrong parent hash. Expected {expected:?}, got {got:?}")]
|
||||
WrongParentHash { expected: String, got: String },
|
||||
/// Proposal had wrong number.
|
||||
#[display(fmt="Proposal had wrong number. Expected {:?}, got {:?}", expected, got)]
|
||||
#[error("Proposal had wrong number. Expected {expected:?}, got {got:?}")]
|
||||
WrongNumber { expected: BlockNumber, got: BlockNumber },
|
||||
/// Proposal exceeded the maximum size.
|
||||
#[display(
|
||||
fmt="Proposal exceeded the maximum size of {} by {} bytes.",
|
||||
"MAX_BLOCK_SIZE", "_0.saturating_sub(MAX_BLOCK_SIZE)"
|
||||
#[error(
|
||||
"Proposal exceeded the maximum size of {} by {} bytes.",
|
||||
MAX_BLOCK_SIZE, .0.saturating_sub(MAX_BLOCK_SIZE)
|
||||
)]
|
||||
ProposalTooLarge(usize),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {}
|
||||
|
||||
/// Attempt to evaluate a substrate block as a node block, returning error
|
||||
/// upon any initial validity checks failing.
|
||||
pub fn evaluate_initial<Block: BlockT>(
|
||||
|
||||
Reference in New Issue
Block a user