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

[TD-5992] add error msg

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