summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorNicolas Noble <nnoble@blizzard.com>2013-07-24 14:23:25 -0700
committerNicolas Noble <nnoble@blizzard.com>2013-07-24 14:23:25 -0700
commit712b4bed9973c60b5c139f98e51ed804ce8a628d (patch)
tree5a634d54a49d71e1dc6091092d8a8f763403446b /includes
parente37ef65aaa42e790a741c15dbae9b83e9c04cd3a (diff)
Better exception handling support for Lua.
Diffstat (limited to 'includes')
-rw-r--r--includes/LuaTask.h6
1 files changed, 4 insertions, 2 deletions
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;