Skip to content

Commit

Permalink
fix: don't crash on malformed mets files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominick Leppich committed Nov 25, 2024
1 parent db92373 commit 52c96c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion migration/lib/mets_manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ def create_backup(self):
logging.debug(f'Backed up mets file: {backup_filename}')

def process_mets_file(self):
tree = ET.parse(self.file_path)
try:
tree = ET.parse(self.file_path)
except Exception as e:
logging.error(f'Error parsing mets file {self.file_path}, skipping')
self.ctx.log_issue(self.file_path, error)
return

root = tree.getroot()
self.process_node(root)

Expand Down

0 comments on commit 52c96c1

Please sign in to comment.