[cleanup] Simplify exception reraising (#17810)

Authored by: doe1080
This commit is contained in:
doe1080
2026-12-01 04:25:59 +00:00
committed by GitHub
parent 91171a9d1a
commit 3b969ea45e
7 changed files with 10 additions and 9 deletions
+1
View File
@@ -322,6 +322,7 @@ select = [
"SIM", # flake8-simplify
"TID251", # banned-api
"TD", # flake8-todos
"TRY201", # verbose-raise
"PLC", # Pylint Convention
"PLE", # Pylint Error
"PLW", # Pylint Warning
+1 -1
View File
@@ -225,7 +225,7 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
break
except ExtractorError as e:
if not isinstance(e.cause, HTTPError):
raise e
raise
if e.cause.status == 401:
# This usually goes away with a different random pkcs1pad, so retry
+1 -1
View File
@@ -62,7 +62,7 @@ class AudiusBaseIE(InfoExtractor):
if 'Failed to parse JSON' in str(exc):
raise ExtractorError('An error occurred while receiving data. Try again',
expected=True)
raise exc
raise
return self._get_response_data(response)
def _resolve_url(self, url, item_id):
+3 -3
View File
@@ -780,7 +780,7 @@ class InfoExtractor:
except ExtractorError as e:
e.video_id = e.video_id or self.get_temp_id(url)
e.ie = e.ie or self.IE_NAME
e.traceback = e.traceback or sys.exc_info()[2]
e.traceback = e.traceback or e.__traceback__
raise
except IncompleteRead as e:
raise ExtractorError('A network error has occurred.', cause=e, expected=True, video_id=self.get_temp_id(url))
@@ -1194,10 +1194,10 @@ class InfoExtractor:
while True:
try:
return self.__download_webpage(url_or_request, video_id, note, errnote, None, fatal, *args, **kwargs)
except IncompleteRead as e:
except IncompleteRead:
try_count += 1
if try_count >= tries:
raise e
raise
self._sleep(timeout, video_id)
def report_warning(self, msg, video_id=None, *args, only_once=False, **kwargs):
+2 -2
View File
@@ -195,7 +195,7 @@ class RCTIPlusIE(RCTIPlusBaseIE):
if isinstance(e.cause, HTTPError) and e.cause.status == 403:
self.raise_geo_restricted(countries=['ID'], metadata_available=True)
else:
raise e
raise
for f in formats:
if 'akamaized' in f['url'] or 'cloudfront' in f['url']:
f.setdefault('http_headers', {})['Referer'] = 'https://www.rctiplus.com/' # Referer header is required for akamai/cloudfront CDNs
@@ -272,7 +272,7 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
except ExtractorError as e:
if 'not found' in str(e):
return []
raise e
raise
if total_pages <= 0:
return []
+1 -1
View File
@@ -89,7 +89,7 @@ class TrueIDIE(InfoExtractor):
f'https://{domain}/cmsPostProxy/contents/video/{video_id}/streamer?os=android', video_id, data=b'')['data']
except ExtractorError as e:
if not isinstance(e.cause, HTTPError):
raise e
raise
errmsg = self._parse_json(e.cause.response.read().decode(), video_id)['meta']['message']
if 'country' in errmsg:
self.raise_geo_restricted(
+1 -1
View File
@@ -317,7 +317,7 @@ class UrllibResponseAdapter(Response):
return data
except Exception as e:
handle_response_read_exceptions(e)
raise e
raise
def handle_sslerror(e: ssl.SSLError):