mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +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
@@ -14,7 +14,8 @@ readme = "README.md"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
log = { version = "0.4.8", optional = true }
|
||||
log = { version = "0.4.11", optional = true }
|
||||
thiserror = { version = "1.0.21", optional = true }
|
||||
parking_lot = { version = "0.10.0", optional = true }
|
||||
hash-db = { version = "0.15.2", default-features = false }
|
||||
trie-db = { version = "0.22.0", default-features = false }
|
||||
@@ -40,14 +41,15 @@ std = [
|
||||
"codec/std",
|
||||
"hash-db/std",
|
||||
"num-traits/std",
|
||||
"sp-core/std",
|
||||
"sp-externalities/std",
|
||||
"sp-std/std",
|
||||
"sp-core/std",
|
||||
"sp-externalities/std",
|
||||
"sp-std/std",
|
||||
"sp-trie/std",
|
||||
"trie-db/std",
|
||||
"trie-root/std",
|
||||
"log",
|
||||
"thiserror",
|
||||
"parking_lot",
|
||||
"rand",
|
||||
"sp-panic-handler",
|
||||
"sp-panic-handler",
|
||||
]
|
||||
|
||||
@@ -22,9 +22,9 @@ use sp_std::fmt;
|
||||
/// State Machine Error bound.
|
||||
///
|
||||
/// This should reflect Wasm error type bound for future compatibility.
|
||||
pub trait Error: 'static + fmt::Debug + fmt::Display + Send {}
|
||||
pub trait Error: 'static + fmt::Debug + fmt::Display + Send + Sync {}
|
||||
|
||||
impl<T: 'static + fmt::Debug + fmt::Display + Send> Error for T {}
|
||||
impl<T: 'static + fmt::Debug + fmt::Display + Send + Sync> Error for T {}
|
||||
|
||||
/// Externalities Error.
|
||||
///
|
||||
@@ -32,17 +32,18 @@ impl<T: 'static + fmt::Debug + fmt::Display + Send> Error for T {}
|
||||
/// would not be executed unless externalities were available. This is included for completeness,
|
||||
/// and as a transition away from the pre-existing framework.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "std", derive(thiserror::Error))]
|
||||
pub enum ExecutionError {
|
||||
/// Backend error.
|
||||
#[cfg_attr(feature = "std", error("Backend error {0:?}"))]
|
||||
Backend(crate::DefaultError),
|
||||
/// The entry `:code` doesn't exist in storage so there's no way we can execute anything.
|
||||
#[cfg_attr(feature = "std", error("`:code` entry does not exist in storage"))]
|
||||
CodeEntryDoesNotExist,
|
||||
/// Backend is incompatible with execution proof generation process.
|
||||
#[cfg_attr(feature = "std", error("Unable to generate proof"))]
|
||||
UnableToGenerateProof,
|
||||
/// Invalid execution proof.
|
||||
#[cfg_attr(feature = "std", error("Invalid execution proof"))]
|
||||
InvalidProof,
|
||||
}
|
||||
|
||||
impl fmt::Display for ExecutionError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Externalities Error") }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user