From 1de94d39e2c54a0d348363b5d857f0bfe5ad2ad9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 May 2019 15:41:38 +0530 Subject: [PATCH] Report detected image type in exception --- src/calibre/utils/img.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/img.py b/src/calibre/utils/img.py index 8c8083cabb..af9a33b24a 100644 --- a/src/calibre/utils/img.py +++ b/src/calibre/utils/img.py @@ -82,9 +82,10 @@ def image_from_data(data): return data i = QImage() if not i.loadFromData(data): - if what(None, data) == 'jxr': + q = what(None, data) + if q == 'jxr': return load_jxr_data(data) - raise NotImage('Not a valid image') + raise NotImage('Not a valid image (detected type: {})'.format(q)) return i