dwm: Connect to socket in try-catch

Catch dwmipc errors and throw a module error if connecting to the socket fails.
This commit is contained in:
Mihir Lad 2020-07-24 00:23:31 -04:00
parent 16f90bea83
commit 8e205eeb15

View File

@ -25,7 +25,11 @@ namespace modules {
throw module_error("Could not find socket: " + (socket_path.empty() ? "<empty>" : socket_path));
}
m_ipc = factory_util::unique<dwmipc::Connection>(socket_path);
try {
m_ipc = factory_util::unique<dwmipc::Connection>(socket_path);
} catch (const dwmipc::IPCError& err) {
throw module_error(err.what());
}
// Load configuration
m_formatter->add(