From 55dc632b100ce7979199191577db2ae4eb12fc77 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 22 Jun 2025 21:38:21 +0200 Subject: [PATCH] Handle HTTP errors. --- profiler/src/profiler/TracyLlmApi.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyLlmApi.cpp b/profiler/src/profiler/TracyLlmApi.cpp index 851848ad..7dfece3f 100644 --- a/profiler/src/profiler/TracyLlmApi.cpp +++ b/profiler/src/profiler/TracyLlmApi.cpp @@ -219,7 +219,12 @@ bool TracyLlmApi::ChatCompletion( const nlohmann::json& req, const std::function } return true; } - return false; + else + { + auto str = std::move( data.str ); + data.str.clear(); + throw std::runtime_error( "HTTP error " + std::to_string( http_code ) + ": " + str ); + } } bool TracyLlmApi::Embeddings( const nlohmann::json& req, nlohmann::json& response, bool separateConnection )