Skip to content

Fixes ConflictError on non-existent objects #264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2013
Merged

Fixes ConflictError on non-existent objects #264

merged 1 commit into from
Jul 1, 2013

Conversation

pavel-kirienko
Copy link
Contributor

The recent refactoring altered the behavior of RiakObject in such a way that reading of non-existent key raises ConflictError. This seems to be a bit wrong since empty object has no conflicting siblings, in fact such an object has no siblings at all.

>>> obj = riak_client.bucket('a_bucket').get('nonexistent')
>>> print obj.data
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "riak/riak_object.py", line 45, in _getter
    raise ConflictError()
riak.ConflictError: 'Object in conflict'   # wrong

Proposed patch makes the RiakObject behave in the same way as before, returning None on attempt to read the empty data:

>>> obj = riak_client.bucket('a_bucket').get('nonexistent')
>>> print obj.data
None

One can suggest to raise a specialized exception in case of empty siblings list - seems OK to me too.

@shuhaowu
Copy link
Contributor

👍 good catch!

hazen pushed a commit that referenced this pull request Jul 1, 2013
Fixes ConflictError on non-existent objects
@hazen hazen merged commit f29e5ab into basho:master Jul 1, 2013
@pavel-kirienko pavel-kirienko deleted the upstream-conflict-error branch July 1, 2013 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants