]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
luawrapper: report caught std::exception as lua_error with a nice reason message 6658/head
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 23 May 2018 15:29:09 +0000 (17:29 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 23 May 2018 15:29:09 +0000 (17:29 +0200)
ext/luawrapper/include/LuaContext.hpp

index 8075aea7987d2a9e60affa8967542ae87f2dadb9..fd22605c486ce383258bd8e9bfcd31337db24cd3 100644 (file)
@@ -2366,9 +2366,15 @@ private:
             lua_pushstring(state, ex.luaType.c_str());
             lua_pushstring(state, " to ");
             lua_pushstring(state, ex.destination.name());
-            lua_concat(state, 4);
+            lua_concat(state, 5);
             luaError(state);
 
+        } catch (const std::exception& e) {
+          luaL_where(state, 1);
+          lua_pushstring(state, "Caught exception: ");
+          lua_pushstring(state, e.what());
+          lua_concat(state, 3);
+          luaError(state);
         } catch (...) {
             Pusher<std::exception_ptr>::push(state, std::current_exception()).release();
             luaError(state);