[svn] commit: r2116 - in /branches/trac172/src/lib/cc: data.cc data.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jun 15 14:40:31 UTC 2010
Author: jelte
Date: Tue Jun 15 14:40:31 2010
New Revision: 2116
Log:
made JSONError a subclass of isc::Exception instead of std:runtime_error
removed the now obsolete DecodeError
Modified:
branches/trac172/src/lib/cc/data.cc
branches/trac172/src/lib/cc/data.h
Modified: branches/trac172/src/lib/cc/data.cc
==============================================================================
--- branches/trac172/src/lib/cc/data.cc (original)
+++ branches/trac172/src/lib/cc/data.cc Tue Jun 15 14:40:31 2010
@@ -208,9 +208,9 @@
if (line != 0 || pos != 0) {
std::stringstream ss;
ss << error << " in " + file + ":" << line << ":" << pos;
- throw JSONError(ss.str());
- } else {
- throw JSONError(error);
+ isc_throw(JSONError, ss.str());
+ } else {
+ isc_throw(JSONError, error);
}
}
}
@@ -389,7 +389,7 @@
in >> i;
pos += count_chars_i(i);
if (in.fail()) {
- throw JSONError("Bad integer or overflow");
+ isc_throw(JSONError, "Bad integer or overflow");
}
if (in.peek() == '.') {
is_double = true;
@@ -397,7 +397,7 @@
pos++;
in >> d_i;
if (in.fail()) {
- throw JSONError("Bad real or overflow");
+ isc_throw(JSONError, "Bad real or overflow");
}
d = i + (double)d_i / 10;
pos += count_chars_i(d_i);
@@ -409,12 +409,12 @@
pos++;
in >> e;
if (in.fail()) {
- throw JSONError("Bad exponent or overflow");
+ isc_throw(JSONError, "Bad exponent or overflow");
}
pos += count_chars_i(e);
p = pow(10, e);
if (p == HUGE_VAL) {
- throw JSONError("Bad exponent or overflow");
+ isc_throw(JSONError, "Bad exponent or overflow");
}
if (is_double) {
d = d * p;
@@ -601,7 +601,7 @@
if (el_read) {
return element;
} else {
- throw JSONError("nothing read");
+ isc_throw(JSONError, "nothing read");
}
}
Modified: branches/trac172/src/lib/cc/data.h
==============================================================================
--- branches/trac172/src/lib/cc/data.h (original)
+++ branches/trac172/src/lib/cc/data.h Tue Jun 15 14:40:31 2010
@@ -48,22 +48,10 @@
// i'd like to use Exception here but we need one that is derived from
// runtime_error (as this one is directly based on external data, and
// i want to add some values to any static data string that is provided)
-class JSONError : public std::runtime_error {
-public:
- JSONError(const std::string &err) : std::runtime_error(err) {};
-};
-
-///
-/// \brief A standard Data module exception that is thrown if an error
-/// is found when decoding an Element from wire format
-///
-class DecodeError : public std::exception {
-public:
- DecodeError(std::string m = "Wire-format data is invalid") : msg(m) {}
- ~DecodeError() throw() {}
- const char* what() const throw() { return msg.c_str(); }
-private:
- std::string msg;
+class JSONError : public isc::Exception {
+public:
+ JSONError(const char* file, size_t line, const char* what) :
+ isc::Exception(file, line, what) {}
};
///
More information about the bind10-changes
mailing list