Commit 123d209d authored by Lucas Carvalho's avatar Lucas Carvalho

Raise MultipleFileFoundError.

If the directory has more than one entry, the lib must raise such Error.
parent 51839a7f
......@@ -163,7 +163,16 @@ class NetworkcacheClient(object):
if result.status != 200:
raise DirectoryNotFound(result.read())
return json.loads(data)
data_list = json.loads(data)
if len(data_list) > 1:
raise MultipleFileFoundError('Too many entries for a given directory. ' \
'Directory: %s. Entries: %s.' % (directory_key, str(data_list)))
return data_list
class MultipleFileFoundError(Exception):
pass
class DirectoryNotFound(Exception):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment