diff --git a/vdirsyncer/exceptions.py b/vdirsyncer/exceptions.py index a5e541b..8acf654 100644 --- a/vdirsyncer/exceptions.py +++ b/vdirsyncer/exceptions.py @@ -42,7 +42,8 @@ class NotFoundError(PreconditionFailed): class AlreadyExistingError(PreconditionFailed): - '''Item already exists''' + '''Item already exists.''' + existing_href = None class WrongEtagError(PreconditionFailed): diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py index 5d8e03d..68658f0 100644 --- a/vdirsyncer/storage/filesystem.py +++ b/vdirsyncer/storage/filesystem.py @@ -138,7 +138,7 @@ class FilesystemStorage(Storage): return fpath, get_etag_from_fileobject(f) except OSError as e: if e.errno == errno.EEXIST: - raise exceptions.AlreadyExistingError(item) + raise exceptions.AlreadyExistingError(existing_href=href) else: raise diff --git a/vdirsyncer/storage/memory.py b/vdirsyncer/storage/memory.py index 8a32f3d..765f8cd 100644 --- a/vdirsyncer/storage/memory.py +++ b/vdirsyncer/storage/memory.py @@ -41,7 +41,7 @@ class MemoryStorage(Storage): def upload(self, item): href = self._get_href(item) if href in self.items: - raise exceptions.AlreadyExistingError(item) + raise exceptions.AlreadyExistingError(existing_href=href) etag = _random_string() self.items[href] = (etag, item) return href, etag diff --git a/vdirsyncer/storage/singlefile.py b/vdirsyncer/storage/singlefile.py index 45ca28f..8232c93 100644 --- a/vdirsyncer/storage/singlefile.py +++ b/vdirsyncer/storage/singlefile.py @@ -134,7 +134,7 @@ class SingleFileStorage(Storage): def upload(self, item): href = item.ident if href in self._items: - raise exceptions.AlreadyExistingError(href) + raise exceptions.AlreadyExistingError(existing_href=href) self._items[href] = item, item.hash return href, item.hash