Skip to content
Snippets Groups Projects
Commit f4f23dfd authored by bgallois's avatar bgallois Committed by Hugo Trentesaux
Browse files

remove unused errors

parent a0afb078
No related branches found
No related tags found
1 merge request!294Fix #264: Distance inherent data provider should not fail
...@@ -35,29 +35,14 @@ pub struct ComputationResult { ...@@ -35,29 +35,14 @@ pub struct ComputationResult {
pub distances: scale_info::prelude::vec::Vec<Perbill>, pub distances: scale_info::prelude::vec::Vec<Perbill>,
} }
/// Errors that can occur while checking the inherent data in `ProvideInherent::check_inherent` from pallet-distance.
#[derive(Encode, sp_runtime::RuntimeDebug)] #[derive(Encode, sp_runtime::RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Decode, thiserror::Error))] #[cfg_attr(feature = "std", derive(Decode, thiserror::Error))]
pub enum InherentError { pub enum InherentError {}
#[cfg_attr(feature = "std", error("InvalidComputationResultFile"))]
InvalidComputationResultFile,
}
impl IsFatalError for InherentError { impl IsFatalError for InherentError {
fn is_fatal_error(&self) -> bool { fn is_fatal_error(&self) -> bool {
match self { false
InherentError::InvalidComputationResultFile => false,
}
}
}
impl InherentError {
#[cfg(feature = "std")]
pub fn try_from(id: &InherentIdentifier, mut data: &[u8]) -> Option<Self> {
if id == &INHERENT_IDENTIFIER {
<InherentError as codec::Decode>::decode(&mut data).ok()
} else {
None
}
} }
} }
...@@ -94,15 +79,12 @@ impl<IdtyIndex: Decode + Encode + PartialEq + TypeInfo + Send + Sync> ...@@ -94,15 +79,12 @@ impl<IdtyIndex: Decode + Encode + PartialEq + TypeInfo + Send + Sync>
async fn try_handle_error( async fn try_handle_error(
&self, &self,
identifier: &InherentIdentifier, _identifier: &InherentIdentifier,
error: &[u8], _error: &[u8],
) -> Option<Result<(), sp_inherents::Error>> { ) -> Option<Result<(), sp_inherents::Error>> {
if *identifier != INHERENT_IDENTIFIER { // No errors occur here.
return None; // Errors handled here are emitted in the `ProvideInherent::check_inherent`
} // (from pallet-distance) which is not implemented.
None
Some(Err(sp_inherents::Error::Application(Box::from(
InherentError::try_from(&INHERENT_IDENTIFIER, error)?,
))))
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment