Http: add Status::ToString method, use to report errors to sentry for custom fingerprint

This commit is contained in:
Lion Kortlepel
2021-08-12 16:13:36 +02:00
committed by Lion
parent e8665bfb72
commit f98c8dabb0
3 changed files with 80 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ void THeartbeatThread::operator()() {
#if DEBUG
debug("sending log to sentry: " + std::to_string(status) + " for " + transaction);
#endif // DEBUG
Sentry.Log(SentryLevel::Error, "default", "unexpected backend response (" + std::to_string(status) + ")");
Sentry.Log(SentryLevel::Error, "default", Http::Status::ToString(status) + " (" + std::to_string(status) + ")");
};
auto Target = "/heartbeat";
@@ -66,7 +66,7 @@ void THeartbeatThread::operator()() {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
T = Http::POST(Application::GetBackup2Hostname(), Target, {}, Body, false, &ResponseCode);
if (T.substr(0, 2) != "20" || ResponseCode != 200) {
warn("Backend system refused server! Server might not show in the public list");
warn("Backend system refused server! Server will not show in the public server list.");
isAuth = false;
SentryReportError(Application::GetBackup2Hostname() + Target, ResponseCode);
}