Browse Source

v3.1.9| 修复错误返回的描述异常的问题

try_support_dt100n
zhaohe 4 weeks ago
parent
commit
ac2ca62b1c
  1. 26
      app_protocols/appexception/appexception.hpp
  2. 2
      appsrc/appconfig/basic/zappversion.hpp
  3. 2
      appsrc/baseservice/front_msg_processer/front_msg_processer.cpp

26
app_protocols/appexception/appexception.hpp

@ -22,6 +22,7 @@
#include "app_protocols/apperrorcode/apperrorcode.hpp"
#include "app_protocols/transmit_disfection_protocol/transmit_disfection_protocol.hpp"
#include "iflytop/core/thisclass/thisclass.hpp"
#include "internationalization.hpp"
namespace iflytop {
using namespace std;
@ -40,16 +41,15 @@ class appexception : public std::exception {
}
appexception(int32_t ecode, const string &description) {
if (description.empty()) {
this->description = Internationalization::ecode2description(ecode);
} else {
this->description = description;
}
this->description = description;
this->ecode = ecode;
this->traceinfo = printStackTrace();
string info;
info += fmt::format("ecode:{}\n", ecode);
info += fmt::format("description:{}\n", description);
info += fmt::format("traceInfo:\n{}\n", traceinfo);
whatstr = info;
whatstr = description;
// thisclass.logger->error(whatstr);
}
@ -140,15 +140,15 @@ class appexception : public std::exception {
return ret;
}
};
}
} // namespace iflytop
#define APPCHECK(expr, ecode, info) \
if (!(expr)) { \
THROW_APP_EXCEPTION(ecode, info); \
}
#define THROW_APP_EXCEPTION(ecode, _info) \
{logger->error("throw exception {}", _info);\
throw appexception(ecode, _info); }
#define THROW_APP_EXCEPTION(ecode, _info) \
{ \
logger->error("throw exception {}", _info); \
throw appexception(ecode, _info); \
}

2
appsrc/appconfig/basic/zappversion.hpp

@ -1,3 +1,3 @@
#pragma once
#define VERSION "3.1.8"
#define VERSION "3.1.9"
#define PROJECT_NAME "TRANSMIT_DM"

2
appsrc/baseservice/front_msg_processer/front_msg_processer.cpp

@ -181,7 +181,7 @@ void FrontMsgProcesser::processMsg(shared_ptr<MsgProcessContext> cxt) {
cxt->receipt["rely"] = cxt->rely;
} catch (const appexception& e) {
cxt->receipt["ackcode"] = e.ecode;
cxt->receipt["message"] = e.what();
cxt->receipt["message"] = e.description;
cxt->receipt["traceinfo"] = fmt::format("{}", e.traceinfo);
logger->error("appexception: {}", e.what());
}

Loading…
Cancel
Save