mbr / simplekv

A simple key-value store for binary data.
http://simplekv.readthedocs.io
MIT License
152 stars 50 forks source link

AzureException always raised as KeyError #62

Closed monika-moeddel-by closed 6 years ago

monika-moeddel-by commented 6 years ago

Hi, when trying to put a file to an azure blob storage

store.put_file('myfile.txt','myfile.txt')

this confusing KeyError was returned: File "...lib/python2.7/site-packages/simplekv/__init__.py", line 177, in put_file return self._put_filename(key, file) File "...lib/python2.7/site-packages/simplekv/net/azurestore.py", line 123, in _put_filename return key File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__ self.gen.throw(type, value, traceback) File "...lib/python2.7/site-packages/simplekv/net/azurestore.py", line 38, in map_azure_exceptions raise KeyError(key) KeyError: 'myfile.txt'

In this case the cause was a missing internet connecting. Could you please consider to improve the exception handling and not raise all AzureException as KeyError.

fmarczin commented 6 years ago

It looks like in this case the exception handling suppresses important information. I will try to come up with a patch.