1use thiserror_context::Context;
5
6#[cfg(feature = "benchmark")]
7use crate::benchmark::BenchmarkError;
8use crate::{persistent, util};
9
10#[derive(Debug, thiserror::Error)]
11#[non_exhaustive]
12pub(crate) enum Inner {
13 #[error("chain error: {0}")]
14 Chain(#[from] linera_chain::ChainError),
15 #[error("chain client error: {0}")]
16 ChainClient(#[from] linera_core::client::ChainClientError),
17 #[error("options error: {0}")]
18 Options(#[from] crate::client_options::Error),
19 #[error("persistence error: {0}")]
20 Persistence(#[source] Box<dyn std::error::Error + Send + Sync>),
21 #[error("view error: {0}")]
22 View(#[from] linera_views::views::ViewError),
23 #[error("non-existent chain: {0:?}")]
24 NonexistentChain(linera_base::identifiers::ChainId),
25 #[error("no keypair found for chain: {0:?}")]
26 NonexistentKeypair(linera_base::identifiers::ChainId),
27 #[error("error on the local node: {0}")]
28 LocalNode(#[from] linera_core::local_node::LocalNodeError),
29 #[error("remote node operation failed: {0}")]
30 RemoteNode(#[from] linera_core::node::NodeError),
31 #[error("chain info response missing latest committee")]
32 ChainInfoResponseMissingCommittee,
33 #[error("arithmetic error: {0}")]
34 Arithmetic(#[from] linera_base::data_types::ArithmeticError),
35 #[error("invalid open message")]
36 InvalidOpenMessage(Option<Box<linera_execution::Message>>),
37 #[error("incorrect chain ownership")]
38 ChainOwnership,
39 #[cfg(feature = "benchmark")]
40 #[error("Benchmark error: {0}")]
41 Benchmark(#[from] BenchmarkError),
42}
43
44thiserror_context::impl_context!(Error(Inner));
45
46util::impl_from_dynamic!(Inner:Persistence, persistent::memory::Error);
47#[cfg(feature = "fs")]
48util::impl_from_dynamic!(Inner:Persistence, persistent::file::Error);
49#[cfg(with_indexed_db)]
50util::impl_from_dynamic!(Inner:Persistence, persistent::indexed_db::Error);