[svn] commit: r1470 - /trunk/src/lib/dns/base32.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 17 00:42:08 UTC 2010


Author: jinmei
Date: Wed Mar 17 00:42:07 2010
New Revision: 1470

Log:
made what() messages of exceptions more helpful

Modified:
    trunk/src/lib/dns/base32.cc

Modified: trunk/src/lib/dns/base32.cc
==============================================================================
--- trunk/src/lib/dns/base32.cc (original)
+++ trunk/src/lib/dns/base32.cc Wed Mar 17 00:42:07 2010
@@ -127,7 +127,7 @@
 
     // base32 text should be a multiple of 8 bytes long
     if (comp.str().length() % 8 != 0) {
-        isc_throw(BadBase32String, "Invalid length");
+        isc_throw(BadBase32String, "Invalid length: " << comp.str().length());
     }
 
     istringstream iss(comp.str());
@@ -138,7 +138,8 @@
 
         iss >> setw(8) >> group;
         if (iss.bad() || iss.fail()) {
-            isc_throw (BadBase32String, "Could not parse base32 input");
+            isc_throw(BadBase32String,
+                      "Could not parse base32 input: " << base32);
         }
 
         uint8_t octet = 0;
@@ -147,7 +148,7 @@
             int value;
 
             if (c != '=' && seenpad) {
-                isc_throw(BadBase32String, "Invalid base32 input");
+                isc_throw(BadBase32String, "Invalid base32 input: " << base32);
             } else 
 
             if (c == '=' && !seenpad) {
@@ -156,7 +157,8 @@
             } else {
                 const char* pos = strchr(base32hex, c);
                 if (!pos) {
-                    isc_throw(BadBase32String, "Invalid base32 input");
+                    isc_throw(BadBase32String,
+                              "Invalid base32 input: " << base32);
                 }
                 value = pos - base32hex;
                 assert (value < 32);




More information about the bind10-changes mailing list