File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include < KDNetwork/http_client.h>
1313#include < KDNetwork/http_response.h>
1414
15+ #include < KDUtils/logging.h>
16+
1517namespace KDNetwork {
1618
1719class 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
142145SseClient::~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
147155void 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
220228void SseClient::disconnect ()
You can’t perform that action at this time.
0 commit comments