diff options
-rw-r--r-- | includes/LuaTask.h | 3 | ||||
-rw-r--r-- | src/BLua.cc | 6 | ||||
-rw-r--r-- | src/LuaTask.cc | 7 |
3 files changed, 12 insertions, 4 deletions
diff --git a/includes/LuaTask.h b/includes/LuaTask.h index 37d64fa..9c495e8 100644 --- a/includes/LuaTask.h +++ b/includes/LuaTask.h @@ -15,11 +15,14 @@ class LuaExecCell { virtual ~LuaExecCell() { } void detach() { m_detached = true; } void exec(LuaMainTask * mainTask); + bool gotError() { return m_gotError; } protected: virtual void run(Lua &) = 0; + void setError() { m_gotError = true; } private: Events::Async m_event; bool m_detached = false; + bool m_gotError = false; friend class LuaTask; }; diff --git a/src/BLua.cc b/src/BLua.cc index 4c52c7c..e9df8b7 100644 --- a/src/BLua.cc +++ b/src/BLua.cc @@ -759,7 +759,7 @@ void Balau::Lua::showstack(int level) { String t; if (n == 0) { - Printer::log(level, "Stack empty\n"); + Printer::log(level, "Stack empty"); return; } @@ -790,12 +790,12 @@ void Balau::Lua::showstack(int level) { t = "Unknown"; } - Printer::log(level, String(i) + ": " + t + "\n"); + Printer::log(level, String(i) + ": " + t); } } void Balau::Lua::showerror() { - Printer::log(M_ERROR, "Lua object: Got an LUA error, inspecting stack.\n"); + Printer::log(M_ERROR, "Lua object: Got an LUA error, inspecting stack."); showstack(M_ERROR); } diff --git a/src/LuaTask.cc b/src/LuaTask.cc index 7e0b256..12d4435 100644 --- a/src/LuaTask.cc +++ b/src/LuaTask.cc @@ -57,7 +57,12 @@ void Balau::LuaMainTask::Do() { } void Balau::LuaTask::Do() { - m_cell->run(L); + try { + m_cell->run(L); + } + catch (...) { + m_cell->setError(); + } if (m_cell->m_detached) delete m_cell; else |