is it possible for the function Iterator::position
to return a custom error when a None
is reached? This compiles but i'm not so sure.
#[pallet::weight(T::WeightInfo::propose())]
pub fn donate (
proposal_hash: T::Hash
) -> DispatchResult {
let public_props = PublicProps::<T>::get();
public_props.iter().position(|p| p == proposal_hash).ok_or(Error::<T>::ProposalMissing)?;
}
Trying to add a new public function...
https://github.com/paritytech/substrate/blob/master/frame/democracy/src/lib.rs