MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / guardedPcall

Function guardedPcall

app/src/DataModel/Scripting/LuaScriptEngine.cpp:61–75  ·  view source on GitHub ↗

* @brief Calls lua_pcall under a C++ try/catch -- escaped exceptions become LUA_ERRRUN. */

Source from the content-addressed store, hash-verified

59 * @brief Calls lua_pcall under a C++ try/catch -- escaped exceptions become LUA_ERRRUN.
60 */
61[[nodiscard]] static int guardedPcall(lua_State* L, int nargs, int nresults, int msgh) noexcept
62{
63 try {
64 return lua_pcall(L, nargs, nresults, msgh);
65 } catch (...) {
66 qWarning() << "[LuaScriptEngine] Uncaught C++ exception escaped lua_pcall -- "
67 "treating as LUA_ERRRUN. Check Lua build unwind tables.";
68 try {
69 lua_settop(L, 0);
70 lua_pushstring(L, "uncaught Lua exception (escaped lua_pcall)");
71 } catch (...) {
72 }
73 return LUA_ERRRUN;
74 }
75}
76
77/**
78 * @brief Lua atpanic handler that throws so abort() is never reached.

Callers 4

runLoadedChunkMethod · 0.85
probeParseFunctionMethod · 0.85
parseLuaTextMethod · 0.85
parseBinaryMethod · 0.85

Calls 2

lua_settopFunction · 0.85
lua_pushstringFunction · 0.85

Tested by

no test coverage detected