use error_backtrace::{Result, ResultBacktrace}; #[derive(Debug)] struct Error; fn main() -> Result<(), Error> { maybe_error().backtrace()?; Ok(()) } fn maybe_error() -> Result<(), Error> { maybe_error2()?; match maybe_error2() { Ok(x) => x, Err(e) => panic!("Inner error is {:?}", *e), }; Ok(()) } fn maybe_error2() -> Result<(), Error> { error_source()?; Ok(()) } fn error_source() -> Result<(), Error> { Err(Error {}.into()) }