From 6995e5b7f4de5f93011619204ce888c16fb9fc0c Mon Sep 17 00:00:00 2001 From: James Osborne Date: Thu, 11 Jun 2026 22:34:47 -0400 Subject: [PATCH] Improve TeamSync coordinator error logging --- src/TeamSync.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/TeamSync.cc b/src/TeamSync.cc index ca307a1e..c97409db 100644 --- a/src/TeamSync.cc +++ b/src/TeamSync.cc @@ -312,14 +312,19 @@ static asio::awaitable post_json_with_timeout( } } - if (response_code != 200) { - throw std::runtime_error(std::format("coordinator returned HTTP {}", response_code)); - } if (content_length > 0x100000) { throw std::runtime_error("coordinator response is too large"); } std::string response_body = co_await read_http_data(*sock, pending_data, content_length); + + if (response_code != 200) { + throw std::runtime_error(std::format( + "coordinator returned HTTP {} body={}", + response_code, + response_body)); + } + timer->cancel(); co_return phosg::JSON::parse(response_body);