Commit d8dfe40e authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

made what() messages of exceptions more helpful


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1470 e5f2f494-b856-4b98-b285-d166d9295462
parent 23cc6dbb
...@@ -127,7 +127,7 @@ decodeBase32(const string& base32, vector<uint8_t>& result) { ...@@ -127,7 +127,7 @@ decodeBase32(const string& base32, vector<uint8_t>& result) {
// base32 text should be a multiple of 8 bytes long // base32 text should be a multiple of 8 bytes long
if (comp.str().length() % 8 != 0) { if (comp.str().length() % 8 != 0) {
isc_throw(BadBase32String, "Invalid length"); isc_throw(BadBase32String, "Invalid length: " << comp.str().length());
} }
istringstream iss(comp.str()); istringstream iss(comp.str());
...@@ -138,7 +138,8 @@ decodeBase32(const string& base32, vector<uint8_t>& result) { ...@@ -138,7 +138,8 @@ decodeBase32(const string& base32, vector<uint8_t>& result) {
iss >> setw(8) >> group; iss >> setw(8) >> group;
if (iss.bad() || iss.fail()) { 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; uint8_t octet = 0;
...@@ -147,7 +148,7 @@ decodeBase32(const string& base32, vector<uint8_t>& result) { ...@@ -147,7 +148,7 @@ decodeBase32(const string& base32, vector<uint8_t>& result) {
int value; int value;
if (c != '=' && seenpad) { if (c != '=' && seenpad) {
isc_throw(BadBase32String, "Invalid base32 input"); isc_throw(BadBase32String, "Invalid base32 input: " << base32);
} else } else
if (c == '=' && !seenpad) { if (c == '=' && !seenpad) {
...@@ -156,7 +157,8 @@ decodeBase32(const string& base32, vector<uint8_t>& result) { ...@@ -156,7 +157,8 @@ decodeBase32(const string& base32, vector<uint8_t>& result) {
} else { } else {
const char* pos = strchr(base32hex, c); const char* pos = strchr(base32hex, c);
if (!pos) { if (!pos) {
isc_throw(BadBase32String, "Invalid base32 input"); isc_throw(BadBase32String,
"Invalid base32 input: " << base32);
} }
value = pos - base32hex; value = pos - base32hex;
assert (value < 32); assert (value < 32);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment