main: exit on panic

This commit is contained in:
Astro 2022-11-03 16:50:08 +01:00
parent 6ea08de8f0
commit 9682ba2424
1 changed files with 8 additions and 0 deletions

View File

@ -1,4 +1,5 @@
use std::time::Duration;
use std::{panic, process};
use tokio::time::timeout;
mod config;
@ -11,6 +12,13 @@ use worker::Message;
#[tokio::main]
async fn main() {
let orig_hook = panic::take_hook();
panic::set_hook(Box::new(move |panic_info| {
// invoke the default handler and exit the process
orig_hook(panic_info);
process::exit(1);
}));
let config = config::Config::load_file(
&std::env::args()
.skip(1)