]> granicus.if.org Git - pdns/commitdiff
extract nested exception from Luawrapper
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 28 Oct 2016 13:31:53 +0000 (15:31 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 13 Nov 2017 14:40:28 +0000 (15:40 +0100)
Before:
Oct 28 15:30:34 STL error (www.foobar.com/A from 127.0.0.1): Exception thrown by a callback function called by Lua

After:
Oct 28 15:30:34 STL error (www.foobar.com/A from 127.0.0.1): Exception thrown by a callback function called by Lua. Extra info: Found . in wrong position in DNSName www.foobar.com..internal

reported by @elad, thanks!

(cherry picked from commit 068c763422b5830dc15598089f7760e79f5bdf81)

pdns/pdns_recursor.cc

index 4efc81e486900f28c492d55f906ba1527c27390b..6a8ff77bb386cb389faf8bab91adea522a9d9b2b 100644 (file)
@@ -1216,7 +1216,16 @@ void startDoResolve(void *p)
     delete dc;
   }
   catch(std::exception& e) {
-    L<<Logger::Error<<"STL error "<< makeLoginfo(dc)<<": "<<e.what()<<endl;
+    L<<Logger::Error<<"STL error "<< makeLoginfo(dc)<<": "<<e.what();
+
+    // Luawrapper nests the exception from Lua, so we unnest it here
+    try {
+        std::rethrow_if_nested(e);
+    } catch(const std::exception& e) {
+        L<<". Extra info: "<<e.what();
+    } catch(...) {}
+
+    L<<endl;
     delete dc;
   }
   catch(...) {