gbiz_info_api/error/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::fmt::{Debug, Formatter};

pub enum GBizApiError {
    Connection(String),
    JsonParse(String),
}

impl GBizApiError {
    pub fn to_string(&self) -> String {
        match self {
            GBizApiError::Connection(e) => { e.to_string() }
            GBizApiError::JsonParse(e) => { e.to_string() }
        }
    }
}

impl Debug for GBizApiError {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.to_string().as_str())
    }
}