Custom panic

This commit is contained in:
mrMiiao 2022-08-11 16:26:45 +03:00 committed by GitHub
parent b0a29f9041
commit 4ce6784b08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,15 @@ mod interpreter;
use interpreter::Interpreter; use interpreter::Interpreter;
fn main() { fn main() {
std::panic::set_hook(
box |info| {
eprint!("{msg}", msg = match info.message() {
None => "Program panicked!".to_owned(),
Some(x) => x.to_string()
});
}
);
let start = Instant::now(); let start = Instant::now();
let args = Args::parse(); let args = Args::parse();