diff --git a/sigal/gallery.py b/sigal/gallery.py index 8508219..f21ebe7 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -171,21 +171,11 @@ class Image(Media): @cached_property def size(self): - try: - return get_size(self.dst_path) - except (IOError, IndexError, TypeError, AttributeError): - self.logger.warning(u'Could not read size %s', - self.dst_path) - return None + return get_size(self.dst_path) @cached_property def thumb_size(self): - try: - return get_size(self.thumb_path) - except (IOError, IndexError, TypeError, AttributeError): - self.logger.warning(u'Could not read size %s', - self.thumb_path) - return None + return get_size(self.thumb_path) class Video(Media): """Gather all informations on a video file.""" diff --git a/sigal/image.py b/sigal/image.py index 5075812..f91996d 100644 --- a/sigal/image.py +++ b/sigal/image.py @@ -166,8 +166,8 @@ def get_size(file_path): logger = logging.getLogger(__name__) try: im = PILImage.open(file_path) - except: - logger.error("Failed to open %s", file_path) + except (IOError, IndexError, TypeError, AttributeError) as e : + logger.error("Could not read size of %s due to %r", file_path, e) else: width,height = im.size return {