From 56b5b98f1e8b9cb0c6c41d9caf594dd1eb350d79 Mon Sep 17 00:00:00 2001 From: deeplow Date: Wed, 18 Jan 2023 17:02:21 +0000 Subject: [PATCH] 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 --- dangerzone/isolation_provider/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dangerzone/isolation_provider/base.py b/dangerzone/isolation_provider/base.py index d845d70..ef2c740 100644 --- a/dangerzone/isolation_provider/base.py +++ b/dangerzone/isolation_provider/base.py @@ -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: