Skip to content

Commit f8ba3c7

Browse files
committed
fix: add missing stacktrace
1 parent 991acad commit f8ba3c7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/legacy/api/APIHelp.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ inline void LOG_WRONG_ARGS_COUNT(std::string const& func = "") {
6565
#define CATCH(LOG) \
6666
catch (const Exception& e) { \
6767
ll::error_utils::printException(e, lse::LegacyScriptEngine::getInstance().getSelf().getLogger()); \
68+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger("Stacktrace: {0}", e.stacktrace()); \
6869
LOG_ERROR_WITH_SCRIPT_INFO(__FUNCTION__, LOG); \
6970
return Local<Value>(); \
7071
} \
@@ -99,6 +100,7 @@ inline void LOG_WRONG_ARGS_COUNT(std::string const& func = "") {
99100
#define CATCH_C(LOG) \
100101
catch (const Exception& e) { \
101102
ll::error_utils::printException(e, lse::LegacyScriptEngine::getInstance().getSelf().getLogger()); \
103+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger("Stacktrace: {0}", e.stacktrace()); \
102104
LOG_ERROR_WITH_SCRIPT_INFO(__FUNCTION__, LOG); \
103105
return nullptr; \
104106
} \
@@ -112,6 +114,7 @@ inline void LOG_WRONG_ARGS_COUNT(std::string const& func = "") {
112114
#define CATCH_S(LOG) \
113115
catch (const Exception& e) { \
114116
ll::error_utils::printException(e, lse::LegacyScriptEngine::getInstance().getSelf().getLogger()); \
117+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger("Stacktrace: {0}", e.stacktrace()); \
115118
LOG_ERROR_WITH_SCRIPT_INFO(__FUNCTION__, LOG); \
116119
return; \
117120
} \
@@ -125,6 +128,7 @@ inline void LOG_WRONG_ARGS_COUNT(std::string const& func = "") {
125128
#define CATCH_WITHOUT_RETURN(LOG) \
126129
catch (const Exception& e) { \
127130
ll::error_utils::printException(e, lse::LegacyScriptEngine::getInstance().getSelf().getLogger()); \
131+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger("Stacktrace: {0}", e.stacktrace()); \
128132
LOG_ERROR_WITH_SCRIPT_INFO(__FUNCTION__, LOG); \
129133
} \
130134
catch (...) { \
@@ -136,14 +140,23 @@ inline void LOG_WRONG_ARGS_COUNT(std::string const& func = "") {
136140
#define CATCH_IN_CALLBACK(callback) \
137141
catch (const Exception& e) { \
138142
ll::error_utils::printException(e, lse::LegacyScriptEngine::getInstance().getSelf().getLogger()); \
143+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger("Stacktrace: {0}", e.stacktrace()); \
144+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger().error( \
145+
std::string("In callback for ") + callback \
146+
); \
147+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger().error( \
148+
"In Plugin: " + getEngineOwnData()->pluginName \
149+
); \
150+
} \
151+
catch (...) { \
152+
ll::error_utils::printCurrentException(lse::LegacyScriptEngine::getInstance().getSelf().getLogger()); \
139153
lse::LegacyScriptEngine::getInstance().getSelf().getLogger().error( \
140154
std::string("In callback for ") + callback \
141155
); \
142156
lse::LegacyScriptEngine::getInstance().getSelf().getLogger().error( \
143157
"In Plugin: " + getEngineOwnData()->pluginName \
144158
); \
145159
}
146-
147160
#else
148161

149162
// 新的宏定义, 把异常抛入脚本层处理

0 commit comments

Comments
 (0)