From 712b4bed9973c60b5c139f98e51ed804ce8a628d Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 24 Jul 2013 14:23:25 -0700 Subject: Better exception handling support for Lua. --- includes/LuaTask.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'includes/LuaTask.h') diff --git a/includes/LuaTask.h b/includes/LuaTask.h index 50226cd..1f7a0b5 100644 --- a/includes/LuaTask.h +++ b/includes/LuaTask.h @@ -12,10 +12,11 @@ class LuaMainTask; class LuaExecCell { public: LuaExecCell(); - virtual ~LuaExecCell() { } + virtual ~LuaExecCell() { if (m_exception) delete m_exception; } void detach() { m_detached = true; } void exec(LuaMainTask * mainTask); - bool gotError() { return m_gotError; } + bool gotError() { return m_gotError || m_exception; } + void throwError() throw (GeneralException); protected: virtual void run(Lua &) = 0; void setError() { m_gotError = true; } @@ -23,6 +24,7 @@ class LuaExecCell { Events::Async m_event; bool m_detached = false; bool m_gotError = false; + GeneralException * m_exception = NULL; friend class LuaTask; LuaExecCell(const LuaExecCell &) = delete; -- cgit v1.2.3