Skip to content

Commit

Permalink
handle os errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gflohr committed Jul 4, 2024
1 parent 1ece12f commit a71494a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit a71494a

Please sign in to comment.