From a71494a118ee14454575469944c143680eaa18b4 Mon Sep 17 00:00:00 2001 From: Guido Flohr Date: Thu, 4 Jul 2024 16:36:15 +0300 Subject: [PATCH] handle os errors --- src/dialog.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dialog.py b/src/dialog.py index 8ee630d..8fab4ad 100644 --- a/src/dialog.py +++ b/src/dialog.py @@ -197,7 +197,11 @@ def accept(self) -> None: def _on_success(counts: Union[Exception, tuple[int, int, int, int, int]]): if isinstance(counts, Exception): - self._show_exception(counts) + x = counts + if (isinstance(x, OSError)): + show_critical(_('There was an error importing a file: {error}'.format(error=x))) + else: + self._show_exception(counts) return if sum(counts) == 0: @@ -240,6 +244,7 @@ def _do_import(_) -> Union[Exception, tuple[int, int, int, int, int]]: return importer.run() except Exception as e: # pylint: disable=broad-except + print('caught exception ...') return e if not self.file_list.count():