From ac2ca62b1ceb07aff638c5b0fafb1b94682094b3 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 9 Jul 2025 19:39:31 +0800 Subject: [PATCH] =?UTF-8?q?v3.1.9|=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=9A=84=E6=8F=8F=E8=BF=B0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_protocols/appexception/appexception.hpp | 26 +++++++++++----------- appsrc/appconfig/basic/zappversion.hpp | 2 +- .../front_msg_processer/front_msg_processer.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app_protocols/appexception/appexception.hpp b/app_protocols/appexception/appexception.hpp index cb8e839..40f3ae7 100644 --- a/app_protocols/appexception/appexception.hpp +++ b/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); \ + } diff --git a/appsrc/appconfig/basic/zappversion.hpp b/appsrc/appconfig/basic/zappversion.hpp index 3d61bac..66ab898 100644 --- a/appsrc/appconfig/basic/zappversion.hpp +++ b/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" \ No newline at end of file diff --git a/appsrc/baseservice/front_msg_processer/front_msg_processer.cpp b/appsrc/baseservice/front_msg_processer/front_msg_processer.cpp index 09acca1..6b1e36d 100644 --- a/appsrc/baseservice/front_msg_processer/front_msg_processer.cpp +++ b/appsrc/baseservice/front_msg_processer/front_msg_processer.cpp @@ -181,7 +181,7 @@ void FrontMsgProcesser::processMsg(shared_ptr 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()); }