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
use std::fmt::{Debug, Display, Formatter};

#[doc(hidden)]
pub use anyhow::anyhow;

pub type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;

pub struct Error(anyhow::Error);

impl From<anyhow::Error> for Error {
    fn from(value: anyhow::Error) -> Self {
        Error(value)
    }
}

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

impl Display for Error {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        Display::fmt(&self.0, f)
    }
}

impl std::error::Error for Error {}

#[macro_export]
macro_rules! satex_error {
    ($($tt:tt)*) => {
        $crate::Error::from($crate::anyhow!($($tt)*))
    };
}