1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use std::{fmt::{Display, Formatter}, sync::PoisonError};
use log::SetLoggerError;

#[derive(Debug)]
pub struct PoisonErrorWrapper(String);

impl Display for PoisonErrorWrapper {


    fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result {
        self.0.fmt(fmt)
    }
}
impl std::error::Error for PoisonErrorWrapper {}


impl<T> From<PoisonError<T>> for PoisonErrorWrapper
where
    T: std::fmt::Debug {
    fn from(error: PoisonError<T>) -> Self {
        Self(format!("{:?}", error.to_string()))
    }
}


#[derive(Debug)]
pub struct ErrorWrapper(SetLoggerError);

impl Display for ErrorWrapper {
    fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result {
        self.0.fmt(fmt)
    }
}
impl std::error::Error for ErrorWrapper {}

impl From<SetLoggerError> for ErrorWrapper {
    fn from(error: SetLoggerError) -> Self {
        Self(error)
    }
}

pub mod shortcuts {
    pub use std::io::{
        Error as IOError,
        Result as IOResult,
    };
}