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

pub trait ErrorUtils {
    fn print_error(&self, msg: &str);
}

impl<T, E> ErrorUtils for Result<T, E>
where
    E: Debug,
{
    fn print_error(&self, msg: &str) {
        match self {
            Ok(_) => {}
            Err(e) => {
                log::error!("Error: {} {:?}", msg, e);
            }
        }
    }
}