diff options
Diffstat (limited to 'discord/errors.py')
| -rw-r--r-- | discord/errors.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/discord/errors.py b/discord/errors.py index 62fff0b2..746e1740 100644 --- a/discord/errors.py +++ b/discord/errors.py @@ -101,3 +101,21 @@ class LoginFailure(ClientException): failure. """ pass + +class ConnectionClosed(ClientException): + """Exception that's thrown when the gateway connection is + closed for reasons that could not be handled internally. + + Attributes + ----------- + code : int + The close code of the websocket. + reason : str + The reason provided for the closure. + """ + def __init__(self, original): + # This exception is just the same exception except + # reconfigured to subclass ClientException for users + self.code = original.code + self.reason = original.reason + super().__init__(str(original)) |