#[macro_use]
extern crate trackable;
use trackable::error::{TrackableError, Failure};
use trackable::error::{ErrorKind as TrackableErrorKind, ErrorKindExt};
#[derive(Debug, Clone)]
pub struct Error(TrackableError<ErrorKind>);
derive_traits_for_trackable_error_newtype!(Error, ErrorKind);
impl From<Failure> for Error {
fn from(f: Failure) -> Self {
ErrorKind::Other.takes_over(f).into()
}
}
impl From<std::io::Error> for Error {
fn from(f: std::io::Error) -> Self {
ErrorKind::Other.cause(f).into()
}
}
#[derive(Debug, Clone)]
pub enum ErrorKind {
Other,
}
impl TrackableErrorKind for ErrorKind {}
fn main() {
let e = ErrorKind::Other.cause("something wrong");
let e = track!(e);
let e = track!(e);
println!("Error: {}", e);
}