1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-06 03:02:38 +01:00

[update] Fix network error handling (#10486)

Authored by: bashonly
This commit is contained in:
bashonly 2024-07-16 16:10:50 -05:00 committed by GitHub
parent d9cbced493
commit ed1b9ed93d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -310,6 +310,7 @@ def _download_update_spec(self, source_tags):
if isinstance(error, HTTPError) and error.status == 404: if isinstance(error, HTTPError) and error.status == 404:
continue continue
self._report_network_error(f'fetch update spec: {error}') self._report_network_error(f'fetch update spec: {error}')
return None
self._report_error( self._report_error(
f'The requested tag {self.requested_tag} does not exist for {self.requested_repo}', True) f'The requested tag {self.requested_tag} does not exist for {self.requested_repo}', True)
@ -557,9 +558,10 @@ def _report_permission_error(self, file):
def _report_network_error(self, action, delim=';', tag=None): def _report_network_error(self, action, delim=';', tag=None):
if not tag: if not tag:
tag = self.requested_tag tag = self.requested_tag
path = tag if tag == 'latest' else f'tag/{tag}'
self._report_error( self._report_error(
f'Unable to {action}{delim} visit https://github.com/{self.requested_repo}/releases/' f'Unable to {action}{delim} visit '
+ tag if tag == 'latest' else f'tag/{tag}', True) f'https://github.com/{self.requested_repo}/releases/{path}', True)
# XXX: Everything below this line in this class is deprecated / for compat only # XXX: Everything below this line in this class is deprecated / for compat only
@property @property