mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +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)
|
super(Error, self).__init__(*args)
|
||||||
|
|
||||||
|
|
||||||
|
class CollectionNotFound(Error):
|
||||||
|
'''Collection not found'''
|
||||||
|
|
||||||
|
|
||||||
class PreconditionFailed(Error):
|
class PreconditionFailed(Error):
|
||||||
'''
|
'''
|
||||||
- The item doesn't exist although it should
|
- The item doesn't exist although it should
|
||||||
|
|
|
||||||
|
|
@ -325,10 +325,8 @@ def checkdir(path, create=False, mode=0o750):
|
||||||
if create:
|
if create:
|
||||||
os.makedirs(path, mode)
|
os.makedirs(path, mode)
|
||||||
else:
|
else:
|
||||||
raise IOError('Directory {} does not exist. Use create = '
|
raise exceptions.CollectionNotFound('Directory {} does not exist.'
|
||||||
'True in your configuration to automatically '
|
.format(path))
|
||||||
'create it, or create it '
|
|
||||||
'yourself.'.format(path))
|
|
||||||
|
|
||||||
|
|
||||||
def checkfile(path, create=False):
|
def checkfile(path, create=False):
|
||||||
|
|
@ -343,10 +341,8 @@ def checkfile(path, create=False):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
raise IOError('{} is not a file.'.format(path))
|
raise IOError('{} is not a file.'.format(path))
|
||||||
if not create:
|
if not create:
|
||||||
raise IOError('File {} does not exist. Use create = '
|
raise exceptions.CollectionNotFound('File {} does not exist.'
|
||||||
'True in your configuration to automatically '
|
.format(path))
|
||||||
'create it, or create it '
|
|
||||||
'yourself.'.format(path))
|
|
||||||
|
|
||||||
|
|
||||||
class cached_property(object):
|
class cached_property(object):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue