anyhow2 0.1.4

(Fork of anyhow that adds the location where the error first occurred)Flexible concrete Error type built on std::error::Error
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub trait Into<T> {
    fn into_anyhow2(self) -> crate::Result<T>;
}

impl<T> Into<T> for core::result::Result<T, anyhow::Error> {
    #[track_caller]
    fn into_anyhow2(self) -> crate::Result<T> {
        #[cfg(feature = "location")]
        let location = Some(core::panic::Location::caller());
        #[cfg(not(feature = "location"))]
        let location = None;

        self.map_err(|e| crate::Error::from_boxed(e.into_boxed_dyn_error(), location))
    }
}