sub_meta_api/errors/
account.rs1use std::error::Error;
2use std::fmt::{Debug, Display, Formatter};
3
4pub struct NoAccountSet {
5 pub code: u32,
6 pub msg: String,
7}
8
9impl Debug for NoAccountSet {
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 NoAccountSet {
16 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
17 write!(f, "Error Code: {} - Error: {}", self.code, self.msg)
18 }
19}
20
21impl NoAccountSet {
22 pub fn new(location:&str) -> NoAccountSet {
23 NoAccountSet{ code: 0, msg: format!("An account was not set for {}.", location) }
24 }
25}
26
27impl Error for NoAccountSet {
28
29}