diff --git a/src/lib.rs b/src/lib.rs index 629d5b7..fdde245 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ use eyre::Result; use mail_parser::MessageParser; use std::{ ffi::{c_char, CStr}, + panic::catch_unwind, sync::Mutex, }; @@ -44,7 +45,7 @@ extern "C" fn message_handler_wrapper(message: *const c_char) { println!("Creating körtid"); let handle = tokio::runtime::Runtime::new().expect("Couldn't skapa the körtid"); println!("Går in i körtid"); - handle.block_on(message_handler(message)).unwrap(); + let _ = catch_unwind(|| handle.block_on(message_handler(message))); } async fn message_handler(message: String) -> Result<()> {