mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Better error when serializing catalog to XML fails
This commit is contained in:
parent
1cc6f9eb7b
commit
4f364dc351
@ -177,6 +177,7 @@ class CSV_XML(CatalogPlugin):
|
|||||||
else:
|
else:
|
||||||
root = E.calibredb()
|
root = E.calibredb()
|
||||||
for r in data:
|
for r in data:
|
||||||
|
try:
|
||||||
record = E.record()
|
record = E.record()
|
||||||
root.append(record)
|
root.append(record)
|
||||||
|
|
||||||
@ -243,6 +244,8 @@ class CSV_XML(CatalogPlugin):
|
|||||||
|
|
||||||
if 'library_name' in fields:
|
if 'library_name' in fields:
|
||||||
record.append(E.library_name(current_library))
|
record.append(E.library_name(current_library))
|
||||||
|
except Exception as e:
|
||||||
|
raise Exception('Failed to convert {} to XML with error: {}'.format(r['title'], e)) from e
|
||||||
|
|
||||||
with open(path_to_output, 'wb') as f:
|
with open(path_to_output, 'wb') as f:
|
||||||
f.write(etree.tostring(root, encoding='utf-8',
|
f.write(etree.tostring(root, encoding='utf-8',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user