Skip to content

Commit 122ebf5

Browse files
committed
Clang-tidy fixes for sse client
1 parent 8da2394 commit 122ebf5

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/KDNetwork/sse_client.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <KDNetwork/http_client.h>
1313
#include <KDNetwork/http_response.h>
1414

15+
#include <KDUtils/logging.h>
16+
1517
namespace KDNetwork {
1618

1719
class SseClient::Private
@@ -121,6 +123,7 @@ class SseClient::Private
121123
}
122124
} catch (const std::exception &) {
123125
// Invalid retry value, ignore
126+
KDUtils::Logger::logger("SseClient")->warn("Invalid retry value: {}", fieldValue);
124127
}
125128
}
126129
// Ignore other field names as per the spec
@@ -141,7 +144,12 @@ SseClient::SseClient(std::shared_ptr<HttpClient> httpClient)
141144

142145
SseClient::~SseClient()
143146
{
144-
disconnect();
147+
try {
148+
disconnect();
149+
} catch (...) {
150+
// Suppress all exceptions to ensure noexcept destructor but log the error
151+
KDUtils::Logger::logger("SseClient")->error("Exception in SseClient destructor");
152+
}
145153
}
146154

147155
void SseClient::connect(const HttpRequest &request)
@@ -214,7 +222,7 @@ void SseClient::connect(const HttpRequest &request)
214222

215223
// Send the request using the special method that associates this SseClient with the request
216224
// This allows the HttpClient to call our processDataChunk method directly with each new chunk
217-
auto future = d->httpClient->sendWithSseClient(sseRequest, shared_from_this(), responseCallback);
225+
std::ignore = d->httpClient->sendWithSseClient(sseRequest, shared_from_this(), responseCallback);
218226
}
219227

220228
void SseClient::disconnect()

0 commit comments

Comments
 (0)