dwm: Catch IPCError instead of generic exceptions

Don't catch generic exceptions to avoid masking bugs. Only catch IPCError
exceptions since those are all minor errors.
This commit is contained in:
Mihir Lad 2020-07-23 16:20:58 -04:00
parent 871b9f8ba2
commit 4533cf5003

View File

@ -153,7 +153,7 @@ namespace modules {
} catch (const dwmipc::SocketClosedError& err) { } catch (const dwmipc::SocketClosedError& err) {
m_log.err("%s: Disconnected from socket: %s", name(), err.what()); m_log.err("%s: Disconnected from socket: %s", name(), err.what());
return reconnect_dwm(); return reconnect_dwm();
} catch (const exception& err) { } catch (const dwmipc::IPCError& err) {
m_log.err("%s: Failed to handle event (reason: %s)", name(), err.what()); m_log.err("%s: Failed to handle event (reason: %s)", name(), err.what());
} }
return false; return false;
@ -403,7 +403,7 @@ namespace modules {
m_log.notice("%s: Successfully reconnected event to socket", name()); m_log.notice("%s: Successfully reconnected event to socket", name());
} }
return true; return true;
} catch (const exception& err) { } catch (const dwmipc::IPCError& err) {
m_log.err("%s: Failed to reconnect to socket: %s", name(), err.what()); m_log.err("%s: Failed to reconnect to socket: %s", name(), err.what());
} }
return false; return false;