提交 6eff4813 编写于 作者: wmmhello's avatar wmmhello

[TD-5992] add error msg

上级 c74b0282
...@@ -439,40 +439,29 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) { ...@@ -439,40 +439,29 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
} }
#include "cJSON.h" #include "cJSON.h"
typedef struct retMsg{ static int taos_set_config_imp(const char *config){
int ret;
char *msg;
} retMsg;
static retMsg taos_set_config_imp(const char *config){
retMsg ret = {0, "success"};
static bool setConfFlag = false; static bool setConfFlag = false;
if (setConfFlag) { if (setConfFlag) {
tscError("already set config"); tscError("already set config");
ret.msg = "already set config"; return -1;
return ret;
} }
cJSON *root = cJSON_Parse(config); cJSON *root = cJSON_Parse(config);
if (root == NULL) { if (root == NULL) {
tscError("failed to set config, invalid json format: %s", config); tscError("failed to set config, invalid json format: %s", config);
ret.ret = -1; return -1;
ret.msg = "invalid json format";
return ret;
} }
int ret = 0;
int size = cJSON_GetArraySize(root); int size = cJSON_GetArraySize(root);
for(int i = 0; i < size; i++){ for(int i = 0; i < size; i++){
cJSON *item = cJSON_GetArrayItem(root, i); cJSON *item = cJSON_GetArrayItem(root, i);
if (!item) { if (!item) {
tscError("failed to read index:%d", i); tscError("failed to read index:%d", i);
ret.ret = -2; ret = -2;
ret.msg = "part config failed, please see the log";
continue; continue;
} }
if(!taosReadConfigOption(item->string, item->valuestring, NULL, NULL)){ if(!taosReadConfigOption(item->string, item->valuestring, NULL, NULL)){
ret.ret = -2; ret = -2;
ret.msg = "part config failed, please see the log";
} }
} }
taosPrintGlobalCfg(); taosPrintGlobalCfg();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册