Catch exceptions in the thread running HandleConfigUpdate

With dc3062a9b0, exceptions in this code
path were no longer caught properly. This commit restores exception
handling for this function.
This commit is contained in:
Julian Brost 2020-10-08 12:47:18 +02:00
parent 8910784844
commit e04d618ede
1 changed files with 10 additions and 1 deletions

View File

@ -312,7 +312,16 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const D
return Empty;
}
std::thread([origin, params]() { HandleConfigUpdate(origin, params); }).detach();
std::thread([origin, params, listener]() {
try {
HandleConfigUpdate(origin, params);
} catch (const std::exception& ex) {
auto msg ("Exception during config sync: " + DiagnosticInformation(ex));
Log(LogCritical, "ApiListener") << msg;
listener->UpdateLastFailedZonesStageValidation(msg);
}
}).detach();
return Empty;
}