diff --git a/tubesync/common/errors.py b/tubesync/common/errors.py index 2373da7e..4e496e6b 100644 --- a/tubesync/common/errors.py +++ b/tubesync/common/errors.py @@ -26,11 +26,4 @@ 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 + pass \ No newline at end of file diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index b61b901d..55139dd7 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -8,12 +8,13 @@ from datetime import datetime, timedelta from pathlib import Path from django.conf import settings from django.db import models +from django.core.exceptions import SuspiciousOperation from django.core.files.storage import FileSystemStorage from django.core.validators import RegexValidator from django.utils.text import slugify from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from common.errors import NoFormatException, NoImageSourceException +from common.errors import NoFormatException from common.utils import clean_filename from .youtube import (get_media_info as get_youtube_media_info, download_media as download_youtube_media, @@ -491,7 +492,7 @@ class Source(models.Model): @property def get_image_url(self): if self.source_type == self.SOURCE_TYPE_YOUTUBE_PLAYLIST: - raise NoImageSourceException('This source is a playlist so it doesn\'t have thumbnail.') + raise SuspiciousOperation('This source is a playlist so it doesn\'t have thumbnail.') return get_youtube_channel_image_info(self.url)