Skip to content

Commit 8837a61

Browse files
committed
catch error on item.prepare in case of collection upload
1 parent 2c0c0a7 commit 8837a61

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

radicale/app/put.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import errno
2323
import itertools
24+
import logging
2425
import posixpath
2526
import re
2627
import socket
@@ -89,7 +90,15 @@ def prepare(vobject_items: List[vobject.base.Component], path: str,
8990
vobject_collection.add(vobject.base.ContentLine("PRODID", [], PRODID))
9091
item = radicale_item.Item(collection_path=collection_path,
9192
vobject_item=vobject_collection)
92-
item.prepare()
93+
logger.debug("Prepare item with UID '%s'", item.uid)
94+
try:
95+
item.prepare()
96+
except ValueError as e:
97+
if logger.isEnabledFor(logging.DEBUG):
98+
logger.warning("Problem during prepare item with UID '%s' (content below): %s\n%s", item.uid, e, item._text)
99+
else:
100+
logger.warning("Problem during prepare item with UID '%s' (content suppressed in this loglevel): %s", item.uid, e)
101+
raise
93102
items.append(item)
94103
elif write_whole_collection and tag == "VADDRESSBOOK":
95104
for vobject_item in vobject_items:

0 commit comments

Comments
 (0)