]> granicus.if.org Git - pdns/commitdiff
move check down
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 21 May 2018 18:09:26 +0000 (20:09 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 21 May 2018 18:09:26 +0000 (20:09 +0200)
pdns/ws-auth.cc

index 14a1b5fc819ee171bd2f430939493a57e02f546e..b63f1bdbccfe4b47dbe50301ba1686a529437516 100644 (file)
@@ -1642,14 +1642,15 @@ static void patchZone(HttpRequest* req, HttpResponse* resp) {
       apiCheckQNameAllowedCharacters(qname.toString());
       QType qtype;
       qtype = stringFromJson(rrset, "type");
+      if (qtype.getCode() == 0) {
+        throw ApiException("RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type")+": unknown type given");
+      }
+
       if(seen.count({qname, qtype}))
       {
-        throw ApiException("Duplicate RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type"));
+        throw ApiException("Duplicate RRset "+qname.toString()+" IN "+qtype.getName());
       }
       seen.insert({qname, qtype});
-      if (qtype.getCode() == 0) {
-        throw ApiException("RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type")+": unknown type given");
-      }
 
       if (changetype == "DELETE") {
         // delete all matching qname/qtype RRs (and, implicitly comments).