I'm using panic::catch_unwind
to catch a panic:
use std::panic;
fn main() {
let result = panic::catch_unwind(|| {
panic!("test panic");
});
match result {
Ok(res) => res,
Err(_) => println!("caught panic!"),
}
}
This seems to work just fine, but I am still getting the output of the panic to stdout. I'd like this to only print out:
caught panic!
Instead of
thread '<main>' panicked at 'test panic', <anon>:6
note: Run with `RUST_BACKTRACE=1` for a backtrace.
caught panic!