From baa0b5fb9243332ac8837ad6965c7db35934e8c6 Mon Sep 17 00:00:00 2001 From: tcmal Date: Wed, 28 Aug 2024 18:14:51 +0100 Subject: Handle errors in event processing without dying --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index f2ad91b..d76a7a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,7 +93,9 @@ impl<'a> WM<'a> { loop { match self.conn.wait_for_event() { Ok(e) => { - self.dispatch_event(e)?; + if let Err(err) = self.dispatch_event(e) { + eprintln!("error when handling event: {err:#?}\ncontinuing anyway"); + } } Err(Error::Xcb(xcb::Error::Protocol(e))) => { eprintln!("protocol error in event loop: {e:#?}\ncontinuing anyway"); @@ -120,7 +122,7 @@ impl<'a> WM<'a> { // See clients/mod.rs Event::X(x::Event::ConfigureRequest(e)) => { - self.handle_configure_request(&e)?; + self.handle_configure_request(&e); } Event::X(x::Event::ConfigureNotify(e)) => { self.handle_configure_notify(&e)?; -- cgit v1.2.3