[downloader:http] handle exceptions in 'validate'

This isn't strictly necessary for 'exhentai.py', but it improves
efficiency when the adapter is reused
This commit is contained in:
ClosedPort22
2023-03-23 19:57:13 +08:00
parent fcaeaf539c
commit 1a977f0f62

View File

@@ -182,7 +182,11 @@ class HttpDownloader(DownloaderBase):
# check for invalid responses
validate = kwdict.get("_http_validate")
if validate and self.validate:
result = validate(response)
try:
result = validate(response)
except Exception:
self.release_conn(response)
raise
if isinstance(result, str):
url = result
tries -= 1