]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1542] Different rcodes for expected exceptions
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 26 Jan 2012 14:51:47 +0000 (15:51 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Thu, 26 Jan 2012 14:51:47 +0000 (15:51 +0100)
src/bin/bind10/bind10_src.py.in
src/bin/bind10/tests/bind10_test.py.in

index 3e14f0f4e2186c7d02609cf86d80f2459c15e5ea..35ef680200a3737a8d87d30e7de872a982116290 100755 (executable)
@@ -805,6 +805,10 @@ class BoB:
                 'token': token,
                 'path': self._socket_path
             })
+        except isc.bind10.socket_cache.SocketError as e:
+            return isc.config.ccsession.create_answer(2, str(e))
+        except isc.bind10.socket_cache.ShareError as e:
+            return isc.config.ccsession.create_answer(3, str(e))
         except Exception as e:
             return isc.config.ccsession.create_answer(1, str(e))
 
index 63e1446a683d74d6ff45a282459f9710012d6909..4771cad58eb1ee39ac95e126ba1ac5a73d7aa595 100644 (file)
@@ -296,6 +296,13 @@ class TestCacheCommands(unittest.TestCase):
         # to an error, not propagated
         self.__raise_exception = Exception("Test exception")
         check_code(1, self.__socket_args)
+        # The special "expected" exceptions
+        self.__raise_exception = \
+            isc.bind10.socket_cache.ShareError("Not shared")
+        check_code(3, self.__socket_args)
+        self.__raise_exception = \
+            isc.bind10.socket_cache.SocketError("Not shared", 13)
+        check_code(2, self.__socket_args)
 
     def drop_socket(self, token):
         """