|
|
@ -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); \ |
|
|
|
} |