improve errors
This commit is contained in:
parent
bb7e2cd7f3
commit
fb48a2181a
@ -75,19 +75,29 @@ class ProxyElem:
|
|||||||
for url in urls:
|
for url in urls:
|
||||||
if isinstance(url, tuple):
|
if isinstance(url, tuple):
|
||||||
clean_urls.append(url[0])
|
clean_urls.append(url[0])
|
||||||
link_requests.append(
|
|
||||||
ProxyCreateLink.parse_obj(
|
|
||||||
{"upstream": url[0], "ctype": url[1], "region": self.region}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
clean_urls.append(url)
|
clean_urls.append(url)
|
||||||
link_requests.append(
|
|
||||||
ProxyCreateLink.parse_obj({"upstream": url, "region": self.region})
|
|
||||||
)
|
|
||||||
if not isinstance(proxy_server, str):
|
if not isinstance(proxy_server, str):
|
||||||
return clean_urls
|
return clean_urls
|
||||||
|
|
||||||
|
try:
|
||||||
|
for url in urls:
|
||||||
|
if isinstance(url, tuple):
|
||||||
|
link_requests.append(
|
||||||
|
ProxyCreateLink.parse_obj(
|
||||||
|
{"upstream": url[0], "ctype": url[1], "region": self.region}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
link_requests.append(
|
||||||
|
ProxyCreateLink.parse_obj(
|
||||||
|
{"upstream": url, "region": self.region}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except pydantic.ValidationError as e:
|
||||||
|
logger.info(e)
|
||||||
|
return clean_urls
|
||||||
|
|
||||||
response_data: ProxyRequest
|
response_data: ProxyRequest
|
||||||
response_data: ProxyResponse
|
response_data: ProxyResponse
|
||||||
|
|
||||||
@ -105,7 +115,7 @@ class ProxyElem:
|
|||||||
response_data = cast(
|
response_data = cast(
|
||||||
ProxyResponse, ProxyResponse.parse_obj(await resp.text())
|
ProxyResponse, ProxyResponse.parse_obj(await resp.text())
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except (aiohttp.ClientError, pydantic.ValidationError) as e:
|
||||||
logger.info(e)
|
logger.info(e)
|
||||||
else:
|
else:
|
||||||
ret_data = []
|
ret_data = []
|
||||||
|
Loading…
Reference in New Issue
Block a user