Skip to main content

pop_fork/error/
block.rs

1// SPDX-License-Identifier: GPL-3.0
2
3use crate::error::{LocalStorageError, RemoteStorageError, RpcClientError};
4use subxt::config::substrate::H256;
5use thiserror::Error;
6
7/// Errors that can occur when working with blocks.
8#[derive(Debug, Error)]
9pub enum BlockError {
10	/// RPC error while fetching block data.
11	#[error("RPC error: {0}")]
12	Rpc(#[from] RpcClientError),
13
14	/// Storage layer error.
15	#[error("Storage error: {0}")]
16	Storage(#[from] LocalStorageError),
17
18	/// Remote storage layer error.
19	#[error("Remote storage error: {0}")]
20	RemoteStorage(#[from] RemoteStorageError),
21
22	/// Block not found at the specified hash.
23	#[error("Block not found: {0:?}")]
24	BlockHashNotFound(H256),
25
26	/// Block not found at the specified height.
27	#[error("Block not found: {0:?}")]
28	BlockNumberNotFound(u32),
29
30	/// Runtime code not found in storage.
31	#[error("Runtime code not found in storage")]
32	RuntimeCodeNotFound,
33
34	/// Concurrent block build detected - parent block changed during build.
35	#[error("Concurrent block build detected: parent block changed during building")]
36	ConcurrentBlockBuild,
37}