Commit 9dc064d3 authored by Lucas Carvalho's avatar Lucas Carvalho

Improved error messages when the user tries to upload a file...

parent 970760af
...@@ -97,7 +97,9 @@ class NetworkcacheClient(object): ...@@ -97,7 +97,9 @@ class NetworkcacheClient(object):
shacache_connection.close() shacache_connection.close()
if result.status != 200: if result.status != 200:
raise UploadError('Failed to upload. Response code: %s. Response data: %s' % (result.status, data)) raise UploadError('Failed to upload the file to SHACACHE Server.' \
'URL: %s. Response code: %s. Response data: %s' % \
(self.shacache_host, result.status, data))
if directory_key is not None: if directory_key is not None:
path = os.path.join(self.shadir_path, directory_key) path = os.path.join(self.shadir_path, directory_key)
...@@ -124,6 +126,11 @@ class NetworkcacheClient(object): ...@@ -124,6 +126,11 @@ class NetworkcacheClient(object):
finally: finally:
shadir_connection.close() shadir_connection.close()
if result.status != 200:
raise UploadError('Failed to upload data to SHADIR Server.' \
'URL: %s. Response code: %s. Response data: %s' % \
(self.shacache_host, result.status, data))
return json.loads(data) return json.loads(data)
def download(self, sha512sum): def download(self, sha512sum):
......
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