Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
feat: implement dunder str in httpexception (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
LordOfPolls committed Sep 1, 2022
1 parent 0081ecb commit 6c31776
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions naff/client/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def __init__(
self.text = data
super().__init__(f"{self.status}|{self.response.reason}: {f'({self.code}) ' if self.code else ''}{self.text}")

def __str__(self) -> str:
errors = self.search_for_message(self.errors)
out = f"HTTPException: {self.status}|{self.response.reason}: " + "\n".join(errors)
return out

@staticmethod
def search_for_message(errors: dict, lookup: Optional[dict] = None) -> list[str]:
"""
Expand Down

0 comments on commit 6c31776

Please sign in to comment.