diff --git a/tubesync/common/errors.py b/tubesync/common/errors.py index 130510a..2373da7 100644 --- a/tubesync/common/errors.py +++ b/tubesync/common/errors.py @@ -27,3 +27,10 @@ class DatabaseConnectionError(Exception): Raised when parsing or initially connecting to a database. ''' pass + + +class NoImageSourceException(Exception): + ''' + Raised when images are requested from a source of a type that does not have any. + ''' + pass diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index ce6d9dc..dceb38b 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -491,7 +491,7 @@ class Source(models.Model): @property def get_image_url(self): if self.source_type == self.SOURCE_TYPE_YOUTUBE_PLAYLIST: - raise Exception('This source is a playlist so it doesn\'t have thumbnail.') + raise NoImageSourceException('This source is a playlist so it doesn\'t have thumbnail.') return get_youtube_channel_image_info(self.url)