Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
greeeen-dev committed Sep 29, 2024
1 parent a19402f commit 88144ee
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions revolt_bridge_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ def __init__(self, *args, **kwargs):
def bot_id(self):
return self.bot.user.id

def error_is_unavoidable(self, error):
if type(error) is [revolt.errors.Forbidden, revolt.errors.ServerError]:
return True
elif type(error) is revolt.errors.HTTPError:
# if revolt.py is sane, the above statement should cover all of these errors
# but we'll add this in here just in case it doesn't
status_code = int(str(error))
return status_code >= 500 or status_code == 401 or status_code == 403
return False

def get_server(self, server_id):
return self.bot.get_server(server_id)

Expand Down

0 comments on commit 88144ee

Please sign in to comment.