Skip to content

Commit 52c96c1

Browse files
author
Dominick Leppich
committed
fix: don't crash on malformed mets files
1 parent db92373 commit 52c96c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

migration/lib/mets_manipulator.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ def create_backup(self):
3030
logging.debug(f'Backed up mets file: {backup_filename}')
3131

3232
def process_mets_file(self):
33-
tree = ET.parse(self.file_path)
33+
try:
34+
tree = ET.parse(self.file_path)
35+
except Exception as e:
36+
logging.error(f'Error parsing mets file {self.file_path}, skipping')
37+
self.ctx.log_issue(self.file_path, error)
38+
return
39+
3440
root = tree.getroot()
3541
self.process_node(root)
3642

0 commit comments

Comments
 (0)