]> granicus.if.org Git - pdns/commitdiff
[wip] LuaJIT raises a 'user data' error, but not an std::exception
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Jun 2016 07:38:44 +0000 (09:38 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Jun 2016 07:38:44 +0000 (09:38 +0200)
This is probably not the best fix, but my journey into LuaJIT
ends here, at least for now.

ext/luawrapper/include/LuaContext.hpp

index 8efccd41b7a4dac0d5d2532d9f3aced30acce8da..2c4bb30e805c08c1ded1e74b14fc322fdbdaadf2 100644 (file)
@@ -1345,10 +1345,13 @@ private:
                     // an exception_ptr was pushed on the stack
                     // rethrowing it with an additional ExecutionErrorException
                     try {
-                        std::rethrow_exception(readTopAndPop<std::exception_ptr>(state, std::move(errorCode)));
+                        if (const auto exp = readTopAndPop<std::exception_ptr>(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"};
                 }
             }
         }