Skip to content

Commit

Permalink
clan try-exvept to only take non haystack errors into account
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosFerLo committed Jun 11, 2024
1 parent 9173433 commit f391948
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions haystack/components/converters/docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ def run(
try:
paragraphs = [para.text for para in file.paragraphs]
text = "\n".join(paragraphs)
merged_metadata = {**bytestream.meta, **metadata}
document = Document(content=text, meta=merged_metadata)
except Exception as e:
logger.warning(f"Could not convert {source} to a Document, skipping it. Error: {e}")
continue

merged_metadata = {**bytestream.meta, **metadata}
document = Document(content=text, meta=merged_metadata)

documents.append(document)

return {"documents": documents}

0 comments on commit f391948

Please sign in to comment.