Add key name to an exception

This commit is contained in:
Łukasz Oleś 2015-09-22 18:55:58 +02:00
parent 6d14515950
commit e29eafd4ed

View File

@ -148,12 +148,13 @@ class RedisGraphDB(BaseGraphDB):
"""Fetch element with given name and collection type."""
try:
item = self._r.get(self._make_collection_key(collection, name))
collection_key = self._make_collection_key(collection, name)
item = self._r.get(collection_key)
if not item and return_empty:
return item
return json.loads(item)
except TypeError:
raise KeyError
raise KeyError(collection_key)
def delete(self, name, collection=BaseGraphDB.DEFAULT_COLLECTION):
keys = self._r.keys(self._make_collection_key(collection, name))