Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 26466d3

Browse files
fix: improve error handling for remote engine (#1975)
Co-authored-by: sangjanai <[email protected]>
1 parent 111a657 commit 26466d3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

engine/extensions/remote-engine/remote_engine.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ size_t StreamWriteCallback(char* ptr, size_t size, size_t nmemb,
2929
CTL_DBG(chunk);
3030
Json::Value check_error;
3131
Json::Reader reader;
32-
if (reader.parse(chunk, check_error)) {
32+
context->chunks += chunk;
33+
if (reader.parse(context->chunks, check_error) ||
34+
(reader.parse(chunk, check_error) &&
35+
chunk.find("error") != std::string::npos)) {
36+
CTL_WRN(context->chunks);
3337
CTL_WRN(chunk);
3438
CTL_INF("Request: " << context->last_request);
3539
Json::Value status;

engine/extensions/remote-engine/remote_engine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct StreamContext {
2626
std::string stream_template;
2727
bool need_stop = true;
2828
std::string last_request;
29+
std::string chunks;
2930
};
3031
struct CurlResponse {
3132
std::string body;

0 commit comments

Comments
 (0)