From 1e983639f790d761073df39df355fcc4991c23ed Mon Sep 17 00:00:00 2001 From: Christoph Auer Date: Fri, 23 Aug 2024 13:07:40 +0200 Subject: [PATCH] Raise from page backend if page is not correctly parsed Signed-off-by: Christoph Auer --- docling/backend/docling_parse_backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docling/backend/docling_parse_backend.py b/docling/backend/docling_parse_backend.py index 905d3655..8ccc0c83 100644 --- a/docling/backend/docling_parse_backend.py +++ b/docling/backend/docling_parse_backend.py @@ -28,6 +28,10 @@ class DoclingParsePageBackend(PdfPageBackend): self.broken_page = "pages" not in parsed_page if not self.broken_page: self._dpage = parsed_page["pages"][0] + else: + raise RuntimeError( + f"Page {page_no} of document {document_hash} could not be parsed." + ) def get_text_in_rect(self, bbox: BoundingBox) -> str: if self.broken_page: