sub_meta_api/errors/
pallet.rs1use std::error::Error;
2use std::fmt::{Debug, Display, Formatter};
3
4pub struct PalletNotFound {
5 pub code: u32,
6 pub msg: String,
7}
8
9impl Debug for PalletNotFound {
10 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
11 write!(f, "Error Code: {} - Error: {}", self.code, self.msg)
12 }
13}
14
15impl Display for PalletNotFound {
16 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
17 write!(f, "Error Code: {} - Error: {}", self.code, self.msg)
18 }
19}
20
21impl PalletNotFound {
22 pub fn new(location:&str) -> PalletNotFound {
23 PalletNotFound{ code: 0, msg: format!("Pallet {} is not configured for this chain.", location) }
24 }
25}
26
27impl Error for PalletNotFound {
28
29}