From: Michal 'vorner' Vaner Date: Thu, 26 Jan 2012 14:51:47 +0000 (+0100) Subject: [1542] Different rcodes for expected exceptions X-Git-Tag: trac2351_base~273^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efcff547c56719305bc35186683b450ea759d684;p=thirdparty%2Fkea.git [1542] Different rcodes for expected exceptions --- diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in index 3e14f0f4e2..35ef680200 100755 --- a/src/bin/bind10/bind10_src.py.in +++ b/src/bin/bind10/bind10_src.py.in @@ -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)) diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in index 63e1446a68..4771cad58e 100644 --- a/src/bin/bind10/tests/bind10_test.py.in +++ b/src/bin/bind10/tests/bind10_test.py.in @@ -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): """