Skip to content

Commit

Permalink
📞 Convert exceptions to string so they pickle.
Browse files Browse the repository at this point in the history
alexjc committed Aug 1, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4de5451 commit b7b56e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/weboptout/http.py
Original file line number Diff line number Diff line change
@@ -47,23 +47,23 @@ async def _fetch_from_cache_or_network(client, url: str) -> tuple:
try:
html = await response.text()
except UnicodeDecodeError as exc:
report(S.ValidateContentEncoding, fail=True, exception=exc)
report(S.ValidateContentEncoding, fail=True, exception=str(exc))

report(S.ValidateContentLength, fail=len(html) == 0, bytes=len(html))

return str(response.url), dict(response.headers), html

except asyncio.exceptions.TimeoutError as exc:
with client.setup_log() as report:
report(S.ResolveDomain, fail=True, exception=exc)
report(S.ResolveDomain, fail=True, exception=str(exc))

except aiohttp.ClientError as exc:
with client.setup_log() as report:
report(S.EstablishConnection, fail=True, exception=exc)
report(S.EstablishConnection, fail=True, exception=str(exc))

except AssertionError as exc:
with client.setup_log() as report:
report(S.EstablishConnection, fail=True, exception=exc)
report(S.EstablishConnection, fail=True, exception=str(exc))

return url, {}, None

0 comments on commit b7b56e5

Please sign in to comment.