about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-06-25 14:36:29 +0200
committertoonn <toonn@toonn.io>2021-06-25 14:37:18 +0200
commitbab7676e27b433915b6782c37d5e44db08f9d053 (patch)
tree65c84267300cd992cc6c3a9edab35f0f7173d945 /ranger
parent8181077f3b0afc7b6258a85d3a03b7bce23d316c (diff)
downloadranger-bab7676e27b433915b6782c37d5e44db08f9d053.tar.gz
img_display: Make the unsupported exception friendlier
Fixes #2373
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/img_display.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 6cb6a815..b7e6572f 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -31,7 +31,7 @@ import codecs
 from tempfile import NamedTemporaryFile
 
 from ranger import PY3
-from ranger.core.shared import FileManagerAware
+from ranger.core.shared import FileManagerAware, SettingsAware
 
 W3MIMGDISPLAY_ENV = "W3MIMGDISPLAY_PATH"
 W3MIMGDISPLAY_OPTIONS = []
@@ -70,8 +70,14 @@ class ImageDisplayError(Exception):
     pass
 
 
-class ImgDisplayUnsupportedException(Exception):
-    pass
+class ImgDisplayUnsupportedException(Exception, SettingsAware):
+    def __init__(self, message=None):
+        if message is None:
+            message = (
+                '"{0}" does not appear to be a valid setting for'
+                ' preview_images_method.'
+            ).format(self.settings.preview_images_method)
+        super(ImgDisplayUnsupportedException, self).__init__(message)
 
 
 def fallback_image_displayer():