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

Commit

Permalink
fix: handle discord not sending an error attrib in exceptions (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
LordOfPolls authored Sep 14, 2022
1 parent ebc3675 commit 786db12
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions naff/client/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ def __init__(
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)
if self.errors:
errors = self.search_for_message(self.errors)
out = f"HTTPException: {self.status}|{self.response.reason}: " + "\n".join(errors)
else:
out = f"HTTPException: {self.status}|{self.response.reason} || {self.text}"
return out

@staticmethod
Expand Down

0 comments on commit 786db12

Please sign in to comment.