Skip to content

Commit

Permalink
fix assertion error on lua exceptions,
Browse files Browse the repository at this point in the history
lua uses c++ exceptions of type const lua_longjmp * internaly for lua
exceptions.
  • Loading branch information
gfgtdf committed Jul 6, 2014
1 parent 68f8652 commit 792b346
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/lua/ldo.cpp
Expand Up @@ -55,24 +55,27 @@
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
#define LUAI_TRY(L,c,a) \
try { \
try { \
a \
} catch(const tlua_jailbreak_exception &e) { \
e.store(); \
throw; \
} catch(const std::exception &e) { \
lua_pushstring(L, e.what()); \
luaG_errormsg(L); \
throw; \
} catch(...) { \
assert(false && "Lua is swallowing an un-named exception... this indicates a programmer error, please derive all exceptions from std::exception!"); \
try { \
try { \
a \
} catch(const tlua_jailbreak_exception &e) { \
e.store(); \
throw; \
} catch(const std::exception &e) { \
lua_pushstring(L, e.what()); \
luaG_errormsg(L); \
throw; \
} catch (const lua_longjmp *) { \
/*this exception is used internaly by lua exceptions*/ \
throw; \
} catch(...) { \
assert(false && "Lua is swallowing an un-named exception... this indicates a programmer error, please derive all exceptions from std::exception!"); \
throw; \
} \
} catch(...) { \
if((c)->status == 0) \
(c)->status = -1;\
}
} catch(...) { \
if((c)->status == 0) \
(c)->status = -1;\
}
#define luai_jmpbuf int /* dummy variable */


Expand Down

0 comments on commit 792b346

Please sign in to comment.