refactor: Add module::halt(error)

This commit is contained in:
Michael Carlberg 2016-10-25 07:07:22 +02:00
parent bc67e64e79
commit a0f0fc8723
2 changed files with 38 additions and 16 deletions
include/modules

View file

@ -87,18 +87,24 @@ namespace modules {
try {
m_ipc.subscribe(i3ipc::ET_WORKSPACE);
m_ipc.prepare_to_event_handling();
} catch (std::runtime_error& e) {
throw module_error(e.what());
} catch (std::runtime_error& err) {
throw module_error(err.what());
} catch (std::exception& err) {
throw module_error(err.what());
}
// }}}
}
void stop() {
// Shutdown ipc connection when before stopping the module {{{
// Shutdown ipc connection when stopping the module {{{
try {
shutdown(m_ipc.get_event_socket_fd(), SHUT_RD);
shutdown(m_ipc.get_main_socket_fd(), SHUT_RD);
} catch (...) {
}
shutdown(m_ipc.get_event_socket_fd(), SHUT_RD);
shutdown(m_ipc.get_main_socket_fd(), SHUT_RD);
event_module::stop();
// }}}