From: Remi Gacogne Date: Thu, 16 Jun 2016 07:38:44 +0000 (+0200) Subject: [wip] LuaJIT raises a 'user data' error, but not an std::exception X-Git-Tag: auth-4.0.0-rc1~39^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f02913986f4592c3afa5bfd7f1ee4526c001878;p=thirdparty%2Fpdns.git [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. --- 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"}; } } }