提交 c6336990 authored 作者: blu's avatar blu

evcloudsvc bugfix: exception get evmgr config

上级 b095f5ce
...@@ -221,6 +221,7 @@ class HttpSrv{ ...@@ -221,6 +221,7 @@ class HttpSrv{
ret["msg"] = "evcloud bad req: no sn/module param"; ret["msg"] = "evcloud bad req: no sn/module param";
spdlog::error(ret["msg"].get<string>()); spdlog::error(ret["msg"].get<string>());
}else{ }else{
try{
string modname = module.substr(0,4); string modname = module.substr(0,4);
string key; string key;
if(module == "evmgr") { if(module == "evmgr") {
...@@ -233,6 +234,7 @@ class HttpSrv{ ...@@ -233,6 +234,7 @@ class HttpSrv{
} }
key = this->configMap.at(sn + ":" + modname); key = this->configMap.at(sn + ":" + modname);
spdlog::debug("key: ", key);
} }
if(!key.empty()) { if(!key.empty()) {
...@@ -240,7 +242,7 @@ class HttpSrv{ ...@@ -240,7 +242,7 @@ class HttpSrv{
int iret = LVDB::getLocalConfig(config, key); int iret = LVDB::getLocalConfig(config, key);
if(iret < 0) { if(iret < 0) {
ret["code"] = 1; ret["code"] = 1;
ret["msg"] = "evcloud failed to get config with k, v:" + key + " " + this->configMap[key].get<string>(); ret["msg"] = "evcloud failed to get config with key: " + key ;
spdlog::error(ret["msg"].get<string>()); spdlog::error(ret["msg"].get<string>());
}else{ }else{
ret["data"] = config["data"]; ret["data"] = config["data"];
...@@ -250,6 +252,11 @@ class HttpSrv{ ...@@ -250,6 +252,11 @@ class HttpSrv{
ret["code"] = 1; ret["code"] = 1;
ret["msg"] = "no config for sn " + sn + ", module " + module; ret["msg"] = "no config for sn " + sn + ", module " + module;
} }
}catch(exception &e){
ret["code"] = -1;
ret["msg"] = string("evcloudsvc exception: ") + e.what();
spdlog::error(ret["msg"].get<string>());
}
} }
res.set_content(ret.dump(), "text/json"); res.set_content(ret.dump(), "text/json");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论