mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
Some error improvements (#1956)
* Use `HeaderChainError` in parachains module * Use MessageProofError instead of 'static str in some places * Avoid implementing Into<'static str> for some errors We avoid deriving `Debug` for the structs that we use in the runtime and we derive `RuntimeDebug` instead in order to avoid bloating th eruntime with static strs. But implementing `Into<'static str>` does the same. So in some places it makes sense to replace `Into<'static str>` with `Debug`. * Move the messages error definition Move the messages error definition outside of `mod target`
This commit is contained in:
committed by
Bastian Köcher
parent
a4a6902bfb
commit
9b44db0fbe
@@ -25,6 +25,7 @@ use bp_runtime::{
|
||||
};
|
||||
use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::{clone::Clone, cmp::Eq, default::Default, fmt::Debug};
|
||||
use frame_support::PalletError;
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -36,7 +37,7 @@ pub mod justification;
|
||||
pub mod storage_keys;
|
||||
|
||||
/// Header chain error.
|
||||
#[derive(Clone, Eq, PartialEq, RuntimeDebug)]
|
||||
#[derive(Clone, Decode, Encode, Eq, PartialEq, PalletError, Debug, TypeInfo)]
|
||||
pub enum HeaderChainError {
|
||||
/// Header with given hash is missing from the chain.
|
||||
UnknownHeader,
|
||||
@@ -44,15 +45,6 @@ pub enum HeaderChainError {
|
||||
StorageProof(StorageProofError),
|
||||
}
|
||||
|
||||
impl From<HeaderChainError> for &'static str {
|
||||
fn from(err: HeaderChainError) -> &'static str {
|
||||
match err {
|
||||
HeaderChainError::UnknownHeader => "UnknownHeader",
|
||||
HeaderChainError::StorageProof(e) => e.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Header data that we're storing on-chain.
|
||||
///
|
||||
/// Even though we may store full header, our applications (XCM) only use couple of header
|
||||
|
||||
Reference in New Issue
Block a user