Skip to content

Commit

Permalink
ApiListener: Catch & supress clients runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab authored and Al2Klimov committed Sep 3, 2024
1 parent 561aeda commit b9b3e7a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/remote/apilistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,12 @@ void ApiListener::ApiTimerHandler()

for (const JsonRpcConnection::Ptr& client : endpoint->GetClients()) {
if (client->GetTimestamp() == maxTs) {
client->SendMessage(lmessage);
try {
client->SendMessage(lmessage);
} catch (const std::runtime_error& ex) {
Log(LogNotice, "ApiListener")
<< "Error while setting log position for identity '" << endpoint->GetName() << "': " << DiagnosticInformation(ex, false);
}
} else {
client->Disconnect();
}
Expand Down Expand Up @@ -1194,7 +1199,12 @@ void ApiListener::SyncSendMessage(const Endpoint::Ptr& endpoint, const Dictionar
if (client->GetTimestamp() != maxTs)
continue;

client->SendMessage(message);
try {
client->SendMessage(message);
} catch (const std::runtime_error& ex) {
Log(LogNotice, "ApiListener")
<< "Error while sending message to endpoint '" << endpoint->GetName() << "': " << DiagnosticInformation(ex, false);
}
}
}
}
Expand Down

0 comments on commit b9b3e7a

Please sign in to comment.