mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-03 10:25:51 +00:00
Introduce CollectionNotFound
This commit is contained in:
parent
cc0b8ad028
commit
0618a45a28
2 changed files with 8 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue