]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
extract nested exception from Luawrapper 4646/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 28 Oct 2016 13:31:53 +0000 (15:31 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 28 Oct 2016 13:34:55 +0000 (15:34 +0200)
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!

pdns/pdns_recursor.cc

index d98f0803d6ab73bb016bee4ed4b62d5f9ee0de43..4435bab3f9d04b37f640b2af4323200c373ebcec 100644 (file)
@@ -1183,7 +1183,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(...) {