Introduce CollectionNotFound

This commit is contained in:
Markus Unterwaditzer 2014-12-31 13:30:55 +01:00
parent cc0b8ad028
commit 0618a45a28
2 changed files with 8 additions and 8 deletions

View file

@ -23,6 +23,10 @@ class Error(Exception):
super(Error, self).__init__(*args)
class CollectionNotFound(Error):
'''Collection not found'''
class PreconditionFailed(Error):
'''
- The item doesn't exist although it should

View file

@ -325,10 +325,8 @@ def checkdir(path, create=False, mode=0o750):
if create:
os.makedirs(path, mode)
else:
raise IOError('Directory {} does not exist. Use create = '
'True in your configuration to automatically '
'create it, or create it '
'yourself.'.format(path))
raise exceptions.CollectionNotFound('Directory {} does not exist.'
.format(path))
def checkfile(path, create=False):
@ -343,10 +341,8 @@ def checkfile(path, create=False):
if os.path.exists(path):
raise IOError('{} is not a file.'.format(path))
if not create:
raise IOError('File {} does not exist. Use create = '
'True in your configuration to automatically '
'create it, or create it '
'yourself.'.format(path))
raise exceptions.CollectionNotFound('File {} does not exist.'
.format(path))
class cached_property(object):