Parcourir la source

[2850] Change exception type thrown, and document it

Mukund Sivaraman il y a 12 ans
Parent
commit
4a5506ec8f

+ 1 - 1
src/lib/datasrc/memory/zone_writer.cc

@@ -35,7 +35,7 @@ ZoneWriter::ZoneWriter(ZoneTableSegment* segment,
     state_(ZW_UNUSED)
 {
     if (!segment->isWritable()) {
-        isc_throw(isc::Unexpected,
+        isc_throw(isc::InvalidOperation,
                   "Attempt to construct ZoneWriter for a read-only segment");
     }
 }

+ 2 - 0
src/lib/datasrc/memory/zone_writer.h

@@ -42,6 +42,8 @@ class ZoneWriter {
 public:
     /// \brief Constructor
     ///
+    /// \throw isc::InvalidOperation if \c segment is read-only.
+    ///
     /// \param segment The zone table segment to store the zone into.
     /// \param load_action The callback used to load data.
     /// \param install_action The callback used to install the loaded zone.

+ 1 - 1
src/lib/datasrc/tests/memory/zone_writer_unittest.cc

@@ -109,7 +109,7 @@ TEST_F(ZoneWriterTest, constructForReadOnlySegment) {
     EXPECT_THROW(ZoneWriter(&ztable_segment,
                             bind(&ZoneWriterTest::loadAction, this, _1),
                             Name("example.org"), RRClass::IN()),
-                 isc::Unexpected);
+                 isc::InvalidOperation);
 }
 
 // We call it the way we are supposed to, check every callback is called in the