PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.68k stars 906 forks source link

Improve Lua error reporting #6359

Open Habbie opened 6 years ago

Habbie commented 6 years ago

The quality of Lua error reporting between auth, rec, dnsdist, and inside them the various features that use Lua, varies wildly. Some just say 'error in Lua' while others manage to report file names and line numbers.

This ticket is for tracking the places where we should do better.

Habbie commented 6 years ago

One painful area is the conversion between Lua and C++ types. Errors with long mangled C++ type names are not uncommon, and simply demangling them does not improve the situation much, as various type aspects (traits, allocators) then suddenly show up. @nlyan has provided some hints in https://wandbox.org/permlink/BqW1yirRM2en9PNY (mirrored at https://gist.github.com/Habbie/19a1f673d8b4ea66c8df126639b29449)

Habbie commented 6 years ago

We should revisit

dnsdist-console.cc:      if(!strcmp(e.what(),"invalid key to 'next'"))

as well.

Habbie commented 6 years ago

~Specific case: #6535~

Habbie commented 6 years ago

Specific case: #6039

Habbie commented 5 years ago

This should have line numbers:

$ cat dnsdist.conf
setLocal('127.0.0.1:53', {doTCP=true})

nmg = newNMG()
nmg:addMask('foo')
$ ./dnsdist -C ./dnsdist.conf
Fatal Lua error: Exception thrown by a callback function called by Lua
Fatal pdns error: Unable to convert 'foo' to a netmask