I have a substrate pallet A
and it has following Errors Defined
#[pallet::error]
pub enum Error<T> {
/// Not a coffee
InvalidCoffee,
}
trait implementation in Pallet A
pub trait A<AccountId, Error> {
fn is_valid_coffee(coffee_id: u32) -> Result<bool, Error>;
}
impl<T: Config> A<AccountIdOf<T>, Error<T>> for Pallet<T> {
fn is_valid_coffee(coffee_id: u32) -> Result<bool, Error<T>> {
Coffee::<T>::get(coffee_id).ok_or(Error::<T>::InvalidCoffee)
}
}
I am using a trait defined in this Pallet A
(is_valid_coffee
) in pallet B
, it requires the Error defined in Pallet A
. How to import it to Pallet B
?