From 815c0774b9ef1743bbd50b16c949a18fe9ab8bb1 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Mon, 4 Nov 2024 15:05:57 +0700 Subject: [PATCH] fix: print error for models get non exists model (#1624) Co-authored-by: vansangpfiev --- engine/cli/commands/model_get_cmd.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/cli/commands/model_get_cmd.cc b/engine/cli/commands/model_get_cmd.cc index b5b230c9c..0eda66105 100644 --- a/engine/cli/commands/model_get_cmd.cc +++ b/engine/cli/commands/model_get_cmd.cc @@ -8,6 +8,7 @@ #include "httplib.h" #include "server_start_cmd.h" #include "utils/file_manager_utils.h" +#include "utils/json_helper.h" #include "utils/logging_utils.h" namespace commands { @@ -30,7 +31,8 @@ void ModelGetCmd::Exec(const std::string& host, int port, if (res->status == httplib::StatusCode::OK_200) { CLI_LOG(res->body); } else { - CTL_ERR("Model failed to get with status code: " << res->status); + auto root = json_helper::ParseJsonString(res->body); + CLI_LOG(root["message"].asString()); } } else { auto err = res.error();