Browse Source

Change AssertError to assert

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac440@3980 e5f2f494-b856-4b98-b285-d166d9295462
Michal Vaner 14 years ago
parent
commit
d706825b2f
2 changed files with 6 additions and 35 deletions
  1. 5 19
      src/lib/datasrc/zonetable.cc
  2. 1 16
      src/lib/datasrc/zonetable.h

+ 5 - 19
src/lib/datasrc/zonetable.cc

@@ -87,21 +87,11 @@ struct ZoneTable::ZoneTableImpl {
             case ZoneTree::ALREADYEXIST:
                 break;
             // Can Not Happen
-            /*
-             * This should generate no code if the implementation is correct
-             * (since the compiler has complete code of RBTree right now, it
-             * should see it can return only these two values). It is here
-             * to catch programmer errors.
-             */
             default:
-                isc_throw(AssertError,
-                    "RBTree<Zone>::insert returned unexpected result");
+                assert(0);
         }
         // Can Not Happen
-        if (!node) {
-            isc_throw(AssertError,
-                "RBTree<Zone>::insert gave NULL pointer");
-        }
+        assert(node);
 
         // Is it empty? We either just created it or it might be nonterminal
         if (node->isEmpty()) {
@@ -130,15 +120,11 @@ struct ZoneTable::ZoneTableImpl {
                 return (FindResult(result::NOTFOUND, ConstZonePtr()));
             // Can Not Happen
             default:
-                isc_throw(AssertError,
-                    "RBTree<Zone>::find returned unexpected result");
+                assert(0);
         }
 
         // Can Not Happen (remember, NOTFOUND is handled)
-        if (!node) {
-            isc_throw(AssertError,
-                "RBTree<Zone>::find gave NULL pointer");
-        }
+        assert(node);
 
         return (FindResult(my_result, node->getData()));
     }
@@ -159,7 +145,7 @@ ZoneTable::addZone(ZonePtr zone) {
 result::Result
 ZoneTable::removeZone(const Name&) {
     // TODO Implement
-    isc_throw(AssertError, "Not implemented");
+    assert(0);
 }
 
 ZoneTable::FindResult

+ 1 - 16
src/lib/datasrc/zonetable.h

@@ -283,8 +283,6 @@ public:
     /// an exception of class \c InvalidParameter will be thrown.
     /// If internal resource allocation fails, a corresponding standard
     /// exception will be thrown.
-    /// An AssertError throw is in the code, but it should never be
-    /// thrown (and therefore never tried to catch).
     /// This method never throws an exception otherwise.
     ///
     /// \param zone A \c Zone object to be added.
@@ -319,25 +317,12 @@ public:
     /// - \c zone: A <Boost> shared pointer to the found \c Zone object if one
     ///  is found; otherwise \c NULL.
     ///
-    /// This method never throws an exception (actually, there's code to throw
-    /// AssertError, but that one means programmer error, so it should not be
-    /// expected).
+    /// This method never throws an exception.
     ///
     /// \param name A domain name for which the search is performed.
     /// \return A \c FindResult object enclosing the search result (see above).
     FindResult findZone(const isc::dns::Name& name) const;
 
-    /// \brief An internal (programmer) error inside ZoneTable.
-    ///
-    /// This is thrown when the ZoneTable finds itself in an inconsistent
-    /// state. It means there's a bug in the code somewhere.
-    struct AssertError : public isc::Exception {
-        /// \brief Constructor.
-        AssertError(const char* file, size_t line, const char* what) :
-            Exception(file, line, what)
-        { }
-    };
-
 private:
     struct ZoneTableImpl;
     ZoneTableImpl* impl_;