mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-30 14:15:13 +00:00
[cleanup] Minor improvements to error and debug messages
This commit is contained in:
@@ -2459,7 +2459,14 @@ def bug_reports_message(before=';'):
|
||||
|
||||
class YoutubeDLError(Exception):
|
||||
"""Base exception for YoutubeDL errors."""
|
||||
pass
|
||||
msg = None
|
||||
|
||||
def __init__(self, msg=None):
|
||||
if msg is not None:
|
||||
self.msg = msg
|
||||
elif self.msg is None:
|
||||
self.msg = type(self).__name__
|
||||
super().__init__(self.msg)
|
||||
|
||||
|
||||
network_exceptions = [compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error]
|
||||
@@ -2544,7 +2551,7 @@ class EntryNotInPlaylist(YoutubeDLError):
|
||||
This exception will be thrown by YoutubeDL when a requested entry
|
||||
is not found in the playlist info_dict
|
||||
"""
|
||||
pass
|
||||
msg = 'Entry not found in info'
|
||||
|
||||
|
||||
class SameFileError(YoutubeDLError):
|
||||
@@ -2553,7 +2560,12 @@ class SameFileError(YoutubeDLError):
|
||||
This exception will be thrown by FileDownloader objects if they detect
|
||||
multiple files would have to be downloaded to the same file on disk.
|
||||
"""
|
||||
pass
|
||||
msg = 'Fixed output name but more than one file to download'
|
||||
|
||||
def __init__(self, filename=None):
|
||||
if filename is not None:
|
||||
self.msg += f': {filename}'
|
||||
super().__init__(self.msg)
|
||||
|
||||
|
||||
class PostProcessingError(YoutubeDLError):
|
||||
@@ -2572,11 +2584,6 @@ class DownloadCancelled(YoutubeDLError):
|
||||
""" Exception raised when the download queue should be interrupted """
|
||||
msg = 'The download was cancelled'
|
||||
|
||||
def __init__(self, msg=None):
|
||||
if msg is not None:
|
||||
self.msg = msg
|
||||
YoutubeDLError.__init__(self, self.msg)
|
||||
|
||||
|
||||
class ExistingVideoReached(DownloadCancelled):
|
||||
""" --break-on-existing triggered """
|
||||
@@ -2595,7 +2602,7 @@ class MaxDownloadsReached(DownloadCancelled):
|
||||
|
||||
class ThrottledDownload(YoutubeDLError):
|
||||
""" Download speed below --throttled-rate. """
|
||||
pass
|
||||
msg = 'The download speed is below throttle limit'
|
||||
|
||||
|
||||
class UnavailableVideoError(YoutubeDLError):
|
||||
@@ -2604,7 +2611,12 @@ class UnavailableVideoError(YoutubeDLError):
|
||||
This exception will be thrown when a video is requested
|
||||
in a format that is not available for that video.
|
||||
"""
|
||||
pass
|
||||
msg = 'Unable to download video'
|
||||
|
||||
def __init__(self, err=None):
|
||||
if err is not None:
|
||||
self.msg += f': {err}'
|
||||
super().__init__(self.msg)
|
||||
|
||||
|
||||
class ContentTooShortError(YoutubeDLError):
|
||||
|
||||
Reference in New Issue
Block a user