From: Bert Hubert Date: Wed, 12 Apr 2006 08:52:51 +0000 (+0000) Subject: slightly improve error messages and reporting, attempting to zoom in on broken packets X-Git-Tag: rec-3-0~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aab4adb0935c600f561a98a58fd03f9feb016172;p=pdns slightly improve error messages and reporting, attempting to zoom in on broken packets git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@682 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index e604e6c33..d8674fc19 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -293,8 +293,13 @@ void RNAME##RecordContent::report(void) \ RNAME##RecordContent::RNAME##RecordContent(const string& zoneData) : DNSRecordContent(RTYPE) \ { \ - RecordTextReader rtr(zoneData); \ - xfrPacket(rtr); \ + try { \ + RecordTextReader rtr(zoneData); \ + xfrPacket(rtr); \ + } \ + catch(RecordTextException& rtr) { \ + throw MOADNSParser("Parsing record content: "+string(rtr.what())); \ + } \ } \ \ string RNAME##RecordContent::getZoneRepresentation() const \ diff --git a/pdns/lwres.cc b/pdns/lwres.cc index b80114477..8bd5b98a8 100644 --- a/pdns/lwres.cc +++ b/pdns/lwres.cc @@ -35,6 +35,7 @@ #include "syncres.hh" #include "dnswriter.hh" #include "dnsparser.hh" +#include "logger.hh" LWRes::LWRes() { @@ -154,11 +155,16 @@ LWRes::res_t LWRes::result() return ret; // return p.getAnswers(); } + catch(exception &mde) { + if(::arg().mustDo("log-common-errors")) + L<(d_pos)+" in '"+d_string+"'"); + throw RecordTextException("while parsing IP address, expected digits at position "+lexical_cast(d_pos)+" in '"+d_string+"'"); string ip; xfrLabel(ip);