1pub use error_stack::{Report, ResultExt};
2#[derive(Debug, thiserror::Error)]
3#[error("An error occurred")]
4pub struct Error;
5
6pub type Result<T, E = error_stack::Report<Error>> = core::result::Result<T, E>;
7
8pub trait ErrorCC<T> {
9 fn cc(self) -> Result<T>;
10}
11
12impl<T, E> ErrorCC<T> for core::result::Result<T, E>
13where
14 E: core::error::Error + Send + Sync + 'static,
15{
16 #[track_caller]
17 fn cc(self) -> Result<T> {
18 match self {
19 Ok(v) => Ok(v),
20 Err(e) => Err(Report::new(e).change_context(Error)),
21 }
22 }
23}