case QType::MX:
stringtok(recparts, rr.content);
if(recparts.size()==2) {
- if (recparts[1]!=".")
- recparts[1] = toCanonic(d_zonename, recparts[1]).toStringRootDot();
+ if (recparts[1]!=".") {
+ try {
+ recparts[1] = toCanonic(d_zonename, recparts[1]).toStringRootDot();
+ } catch (std::exception &e) {
+ throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+ }
+ }
rr.content=recparts[0]+" "+recparts[1];
}
break;
case QType::SRV:
stringtok(recparts, rr.content);
if(recparts.size()==4) {
- if(recparts[3]!=".")
- recparts[3] = toCanonic(d_zonename, recparts[3]).toStringRootDot();
+ if(recparts[3]!=".") {
+ try {
+ recparts[3] = toCanonic(d_zonename, recparts[3]).toStringRootDot();
+ } catch (std::exception &e) {
+ throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+ }
+ }
rr.content=recparts[0]+" "+recparts[1]+" "+recparts[2]+" "+recparts[3];
}
break;
case QType::DNAME:
case QType::PTR:
case QType::AFSDB:
- rr.content=toCanonic(d_zonename, rr.content).toStringRootDot();
+ try {
+ rr.content = toCanonic(d_zonename, rr.content).toStringRootDot();
+ } catch (std::exception &e) {
+ throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
+ }
break;
case QType::SOA:
try {
recparts[0]=toCanonic(d_zonename, recparts[0]).toStringRootDot();
recparts[1]=toCanonic(d_zonename, recparts[1]).toStringRootDot();
- } catch (runtime_error &re) {
- throw PDNSException(re.what());
+ } catch (std::exception &e) {
+ throw PDNSException("Error in record '" + rr.qname.toString() + " " + rr.qtype.getName() + "': " + e.what());
}
}
rr.content.clear();