Skip to content

Commit

Permalink
Close bot with an error code if authentication has failed
Browse files Browse the repository at this point in the history
  • Loading branch information
4Kaylum committed Feb 8, 2024
1 parent 0e0602a commit 136a601
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion novus/api/gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
from ...enums import GatewayOpcode
from ...flags import Intents
from ...utils import MISSING
from .._errors import GatewayClose, GatewayClosed, GatewayException
from .._errors import (
GatewayAuthenticationFailed,
GatewayClose,
GatewayClosed,
GatewayException,
)
from .._route import Route
from .dispatch import GatewayDispatch

Expand Down Expand Up @@ -317,6 +322,9 @@ async def messages(
self.running_tasks.add(t)
t.add_done_callback(self.running_tasks.discard)
return
except GatewayAuthenticationFailed:
log.info("[%s] Gateway authentication failed, closing with error code", self.shard_id)
exit(1)
except GatewayException as e:
log.debug("[%s] Generic gateway exception %s", self.shard_id, e, exc_info=e)
t = asyncio.create_task(self.reconnect(resume=e.reconnect))
Expand Down

0 comments on commit 136a601

Please sign in to comment.