Report exceptions raised in document conversion

Exceptions raised during the document conversion process would be
silently hidden. This was because ThreadPoolExecuter in logic.py created
various contexts and hid any exceptions raised.

Fixes #309
This commit is contained in:
deeplow 2023-01-18 17:02:21 +00:00
parent 06fe53b0d6
commit 56b5b98f1e
No known key found for this signature in database
GPG key ID: 577982871529A52A

View file

@ -26,7 +26,13 @@ class IsolationProvider(ABC):
stdout_callback: Optional[Callable] = None,
) -> None:
document.mark_as_converting()
success = self._convert(document, ocr_lang, stdout_callback)
try:
success = self._convert(document, ocr_lang, stdout_callback)
except Exception:
success = False
log.exception(
f"An exception occurred while converting document '{document.id}'"
)
if success:
document.mark_as_safe()
if document.archive_after_conversion: