diff options
author | toonn <toonn@toonn.io> | 2021-06-25 14:36:29 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2021-06-25 14:37:18 +0200 |
commit | bab7676e27b433915b6782c37d5e44db08f9d053 (patch) | |
tree | 65c84267300cd992cc6c3a9edab35f0f7173d945 /ranger | |
parent | 8181077f3b0afc7b6258a85d3a03b7bce23d316c (diff) | |
download | ranger-bab7676e27b433915b6782c37d5e44db08f9d053.tar.gz |
img_display: Make the unsupported exception friendlier
Fixes #2373
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/img_display.py | 12 |
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(): |