Skip to content

Commit

Permalink
fix: catch ConnectionResetError
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Oct 5, 2023
1 parent 05dc3e4 commit 942e7cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions abuse_whois/api/endpoints/whois.py
Expand Up @@ -21,3 +21,5 @@ async def whois(query: schemas.Query) -> schemas.Contacts:
raise HTTPException(status.HTTP_404_NOT_FOUND, detail=str(e)) from e
except errors.AbuseWhoisError as e:
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)) from e
except ConnectionResetError as e:
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)) from e
2 changes: 1 addition & 1 deletion abuse_whois/main.py
Expand Up @@ -24,7 +24,7 @@ def whois(
try:
contacts = asyncio.run(get_abuse_contacts(address))
print(contacts.model_dump_json(by_alias=True)) # noqa: T201
except (errors.AbuseWhoisError, asyncio.TimeoutError) as e:
except (errors.AbuseWhoisError, asyncio.TimeoutError, ConnectionResetError) as e:
print(json.dumps({"error": str(e)})) # noqa: T201


Expand Down

0 comments on commit 942e7cd

Please sign in to comment.