Add Exception when images are requested from a source of a type that does not have any
This commit is contained in:
parent
32a884365b
commit
12b9dfbada
|
@ -27,3 +27,10 @@ class DatabaseConnectionError(Exception):
|
||||||
Raised when parsing or initially connecting to a database.
|
Raised when parsing or initially connecting to a database.
|
||||||
'''
|
'''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class NoImageSourceException(Exception):
|
||||||
|
'''
|
||||||
|
Raised when images are requested from a source of a type that does not have any.
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
|
@ -491,7 +491,7 @@ class Source(models.Model):
|
||||||
@property
|
@property
|
||||||
def get_image_url(self):
|
def get_image_url(self):
|
||||||
if self.source_type == self.SOURCE_TYPE_YOUTUBE_PLAYLIST:
|
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)
|
return get_youtube_channel_image_info(self.url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue