From 67bc80188c23712d2e578ebab2ce2d1053f410a0 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Wed, 6 Dec 2023 20:15:39 +0100 Subject: [PATCH] refactor errors pallet-distance --- pallets/distance/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index e97f8fade..d4b14b918 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -187,10 +187,10 @@ pub mod pallet { pub enum Error<T> { /// Distance is already under evaluation. AlreadyInEvaluation, - /// Author requests too many evaluations. - ManyEvaluationsByAuthor, + /// Too many evaluations requested by author. + TooManyEvaluationsByAuthor, /// Too many evaluations for this block. - ManyEvaluationsInBlock, + TooManyEvaluationsInBlock, /// No author for this block. NoAuthor, /// Caller has no identity. @@ -252,7 +252,7 @@ pub mod pallet { ensure_none(origin)?; ensure!( !DidUpdate::<T>::exists(), - Error::<T>::ManyEvaluationsInBlock, + Error::<T>::TooManyEvaluationsInBlock, ); let author = pallet_authorship::Pallet::<T>::author().ok_or(Error::<T>::NoAuthor)?; @@ -297,7 +297,7 @@ pub mod pallet { move |identities| { identities .try_push(identity) - .map_err(|_| Error::<T>::ManyEvaluationsInBlock) + .map_err(|_| Error::<T>::TooManyEvaluationsInBlock) }, )?; Self::deposit_event(Event::EvaluationStatusForced { @@ -323,7 +323,7 @@ pub mod pallet { move |identities| { identities .try_push(identity) - .map_err(|_| Error::<T>::ManyEvaluationsInBlock.into()) + .map_err(|_| Error::<T>::TooManyEvaluationsInBlock.into()) }, ) } @@ -453,7 +453,7 @@ pub mod pallet { Self::deposit_event(Event::EvaluationUpdated { evaluator }); Ok(()) } else { - Err(Error::<T>::ManyEvaluationsByAuthor.into()) + Err(Error::<T>::TooManyEvaluationsByAuthor.into()) } }) } -- GitLab