summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/loader.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 13668a00..0bf7d59a 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -405,13 +405,25 @@ class Loader(FileManagerAware):
 
         end_time = time() + self.seconds_of_work_time
 
-        try:
-            while time() < end_time:
+        while time() < end_time:
+            try:
                 next(item.load_generator)
+            except StopIteration:
+                self._remove_current_process(item)
+                break
+            except Exception as ex:  # pylint: disable=broad-except
+                self.fm.notify(
+                    'Loader work process failed: {0} (Percent: {1})'.format(
+                        item.description, item.percent),
+                    bad=True,
+                    exception=ex,
+                )
+                self.old_item = None
+                self._remove_current_process(item)
+                break
+        else:
             if item.progressbar_supported:
                 self.fm.ui.status.request_redraw()
-        except StopIteration:
-            self._remove_current_process(item)
 
     def _remove_current_process(self, item):
         item.load_generator = None