From 5f02913986f4592c3afa5bfd7f1ee4526c001878 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 16 Jun 2016 09:38:44 +0200 Subject: [PATCH] [wip] LuaJIT raises a 'user data' error, but not an std::exception This is probably not the best fix, but my journey into LuaJIT ends here, at least for now. --- ext/luawrapper/include/LuaContext.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/luawrapper/include/LuaContext.hpp b/ext/luawrapper/include/LuaContext.hpp index 8efccd41b7..2c4bb30e80 100644 --- a/ext/luawrapper/include/LuaContext.hpp +++ b/ext/luawrapper/include/LuaContext.hpp @@ -1345,10 +1345,13 @@ private: // an exception_ptr was pushed on the stack // rethrowing it with an additional ExecutionErrorException try { - std::rethrow_exception(readTopAndPop(state, std::move(errorCode))); + if (const auto exp = readTopAndPop(state, std::move(errorCode))) { + std::rethrow_exception(exp); + } } catch(...) { std::throw_with_nested(ExecutionErrorException{"Exception thrown by a callback function called by Lua"}); } + throw ExecutionErrorException{"Unknown Lua error"}; } } } -- 2.47.2