use ebacktrace::define_error;
use std::fmt::{ self, Display, Formatter };
#[derive(Debug, Copy, Clone)]
enum ErrorKind {
#[allow(unused)]
MyErrorA,
Testolope
}
impl Display for ErrorKind {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{:#?}", self)
}
}
define_error!(Error);
fn will_fail() -> Result<(), Error<ErrorKind>> {
Err(ErrorKind::Testolope.into())
}
#[test]
#[should_panic]
fn test() {
if let Err(e) = will_fail() {
eprintln!("Error: {:?}", e);
eprintln!("Error: {}", e);
panic!("Fatal error: {}", e);
}
}