Raise from page backend if page is not correctly parsed

Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
Christoph Auer 2024-08-23 13:07:40 +02:00
parent b07881324c
commit 1e983639f7

View File

@ -28,6 +28,10 @@ class DoclingParsePageBackend(PdfPageBackend):
self.broken_page = "pages" not in parsed_page self.broken_page = "pages" not in parsed_page
if not self.broken_page: if not self.broken_page:
self._dpage = parsed_page["pages"][0] 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: def get_text_in_rect(self, bbox: BoundingBox) -> str:
if self.broken_page: if self.broken_page: