Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docling_parse/pdf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,10 @@ def load(
lazy: bool = True,
boundary_type: PdfPageBoundaryType = PdfPageBoundaryType.CROP_BOX,
) -> PdfDocument:


success=False
key=None

if isinstance(path_or_stream, str):
path_or_stream = Path(path_or_stream)

Expand Down Expand Up @@ -630,7 +633,10 @@ def load(

return result_doc
else:
raise RuntimeError(f"Failed to load document with key {key}")
if key:
raise RuntimeError(f"Failed to load document with key {key}")
else:
raise RuntimeError(f"Receive path_or_stream type: {type(path_or_stream)}, only support string, Path or BytesIO")

def _load_document(self, key: str, filename: str) -> bool:
"""Load a document by key and filename.
Expand Down
Loading