Skip to content

Commit bd5a1d3

Browse files
committed
Use KazooException instead of RuntimeError in TreeCache
#398 (comment)
1 parent d1b07d3 commit bd5a1d3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

kazoo/recipe/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import functools
2020
import operator
2121

22-
from kazoo.exceptions import NoNodeError
22+
from kazoo.exceptions import NoNodeError, KazooException
2323
from kazoo.protocol.states import KazooState, EventType
2424

2525

@@ -63,7 +63,7 @@ def start(self):
6363
if self._state == self.STATE_LATENT:
6464
self._state = self.STATE_STARTED
6565
else:
66-
raise RuntimeError('already started')
66+
raise KazooException('already started')
6767

6868
self._client.add_listener(self._session_watcher)
6969
self._client.ensure_path(self._root._path)

kazoo/tests/test_cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from nose.tools import eq_, ok_, assert_not_equal, raises
55

66
from kazoo.testing import KazooTestCase
7+
from kazoo.exceptions import KazooException
78
from kazoo.recipe.cache import TreeCache, TreeNode, TreeEvent
89

910

@@ -60,7 +61,7 @@ def test_start(self):
6061
eq_(self.cache._state, TreeCache.STATE_STARTED)
6162
eq_(self.cache._root._state, TreeNode.STATE_LIVE)
6263

63-
@raises(RuntimeError)
64+
@raises(KazooException)
6465
def test_start_twice(self):
6566
self.make_cache()
6667
self.cache.start()

0 commit comments

Comments
 (0)