Browse Source

Change AssertError to assert

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac447@3982 e5f2f494-b856-4b98-b285-d166d9295462
Michal Vaner 14 years ago
parent
commit
c4ed9d019f
2 changed files with 6 additions and 31 deletions
  1. 6 17
      src/lib/datasrc/memory_datasrc.cc
  2. 0 14
      src/lib/datasrc/memory_datasrc.h

+ 6 - 17
src/lib/datasrc/memory_datasrc.cc

@@ -13,7 +13,7 @@
 // PERFORMANCE OF THIS SOFTWARE.
 
 #include <map>
-#include <iostream>
+#include <cassert>
 #include <boost/shared_ptr.hpp>
 
 #include <dns/name.h>
@@ -104,12 +104,9 @@ struct MemoryZone::MemoryZoneImpl {
                 break;
             // Something odd got out
             default:
-                isc_throw(AssertError,
-                    "RBTree<Domain>::insert returned unexpected result");
-        }
-        if (!node) {
-            isc_throw(AssertError, "RBTree<Domain>::insert gave NULL node");
+                assert(0);
         }
+        assert(node);
 
         // Now get the domain
         DomainPtr domain;
@@ -151,18 +148,10 @@ struct MemoryZone::MemoryZoneImpl {
                 case DomainTree::EXACTMATCH: // This one is OK, handle it
                     break;
                 default:
-                    isc_throw(AssertError,
-                        "RBTree<Domain>::find returned unexpected result");
-            }
-            if (!node) {
-                isc_throw(AssertError,
-                    "RBTree<Domain>::find gave NULL node when not returning"
-                    "NOTFOUND");
-            }
-            if (node->isEmpty()) {
-                isc_throw(AssertError,
-                    "RBTree<Domain>::find gave empty node");
+                    assert(0);
             }
+            assert(node);
+            assert(!node->isEmpty());
 
             Domain::const_iterator found(node->getData()->find(type));
             if (found != node->getData()->end()) {

+ 0 - 14
src/lib/datasrc/memory_datasrc.h

@@ -62,9 +62,6 @@ public:
     ///
     /// It returns NULL pointer in case of NXDOMAIN and NXRRSET
     /// (the base class documentation does not seem to require that).
-    ///
-    /// It might throw AssertError as well, but it should not be
-    /// expected (and caught), as it marks programmer error.
     virtual FindResult find(const isc::dns::Name& name,
                             const isc::dns::RRType& type) const;
 
@@ -73,7 +70,6 @@ public:
     /// It puts another RRset into the zone.
     ///
     /// It throws NullRRset or OutOfZone if the provided rrset is invalid.
-    /// It might throw AssertError, but that one marks programmer errors.
     ///
     /// \param rrset The set to add.
     /// \return SUCCESS or EXIST (if an rrset for given name and type already
@@ -99,16 +95,6 @@ public:
         { }
     };
 
-    /// \brief Internal programmer error.
-    ///
-    /// This should not be expected. It means internal inconsistency is
-    /// detected, eg. it marks the "Can Not Happen" conditions.
-    struct AssertError : public Unexpected {
-        AssertError(const char* file, size_t line, const char* what) :
-            Unexpected(file, line, what)
-        { }
-    };
-
 private:
     /// \name Hidden private data
     //@{