diff options
| author | Ben Bangert <ben@groovie.org> | 2012-08-31 11:18:50 -0700 |
|---|---|---|
| committer | Ben Bangert <ben@groovie.org> | 2012-08-31 11:19:19 -0700 |
| commit | 28d9c27d87a4d1e624e1c218e8a25f658c91dbc5 (patch) | |
| tree | 809ebd68c4bf3760ba36c1bdfb03d9334a1e4ed7 | |
| parent | c25237527b9f164dffef542ec4274f0723ffe251 (diff) | |
| download | kazoo-28d9c27d87a4d1e624e1c218e8a25f658c91dbc5.tar.gz | |
Ensure that we don't catch an exists request and all errors, just the nonode one.
| -rw-r--r-- | kazoo/protocol/__init__.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kazoo/protocol/__init__.py b/kazoo/protocol/__init__.py index e23c8ad..0fdfa3a 100644 --- a/kazoo/protocol/__init__.py +++ b/kazoo/protocol/__init__.py @@ -106,8 +106,12 @@ def proto_reader(client, s, reader_started, reader_done, read_timeout): raise RuntimeError('xids do not match, expected %r ' 'received %r', xid, header.xid) + # Determine if its an exists request and a no node error exists_request = isinstance(request, Exists) - if header.err and not exists_request: + exists_error = header.err == NoNodeError.code and exists_request + + # Set the exception if its not an exists error + if header.err and not exists_error: callback_exception = EXCEPTIONS[header.err]() log.debug('Received error %r', callback_exception) if async_object: @@ -130,8 +134,8 @@ def proto_reader(client, s, reader_started, reader_done, read_timeout): async_object.set(response) # Determine if watchers should be registered + watcher = getattr(request, 'watcher', None) with client._state_lock: - watcher = getattr(request, 'watcher', None) if not client._stopped.is_set() and watcher: if isinstance(request, GetChildren): client._child_watchers[request.path].add( |
