1
0
Fork 0
firefox/third_party/rust/error-chain/examples/has_backtrace.rs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

18 lines
457 B
Rust

//! Exits with exit code 0 if backtraces are disabled and 1 if they are enabled.
//! Used by tests to make sure backtraces are available when they should be. Should not be used
//! outside of the tests.
#[macro_use]
extern crate error_chain;
error_chain! {
errors {
MyError
}
}
fn main() {
let err = Error::from(ErrorKind::MyError);
let has_backtrace = err.backtrace().is_some();
::std::process::exit(has_backtrace as i32);
}