Log name of faulty component

If vobject can't parse a component it raises an exception, but the filename of that component is missing in the logs.
This commit is contained in:
Unrud 2016-09-04 13:23:01 +02:00
parent 5ccfe16372
commit 6df54bf88a

View File

@ -631,7 +631,12 @@ class Collection(BaseCollection):
last_modified = time.strftime(
"%a, %d %b %Y %H:%M:%S GMT",
time.gmtime(os.path.getmtime(path)))
return Item(self, vobject.readOne(text), href, last_modified)
try:
item = vobject.readOne(text)
except Exception:
self.logger.error("Failed to parse component: %s", href)
raise
return Item(self, item, href, last_modified)
def upload(self, href, vobject_item):
if not is_safe_filesystem_path_component(href):