refactor: try/catch around json parse

This commit is contained in:
Alex
2019-05-09 10:30:54 +02:00
parent fd9b34adf8
commit 5bf0ca85ac
6 changed files with 55 additions and 48 deletions

View File

@ -131,7 +131,6 @@ void Ipc::sendCmd(uint32_t type, const std::string& payload) {
}
void Ipc::subscribe(const std::string& payload) {
std::lock_guard<std::mutex> lock(mutex_event_);
auto res = Ipc::send(fd_event_, IPC_SUBSCRIBE, payload);
if (res.payload != "{\"success\": true}") {
throw std::runtime_error("Unable to subscribe ipc event");
@ -139,7 +138,6 @@ void Ipc::subscribe(const std::string& payload) {
}
void Ipc::handleEvent() {
std::lock_guard<std::mutex> lock(mutex_event_);
const auto res = Ipc::recv(fd_event_);
signal_event.emit(res);
}