diff options
| author | Rapptz <[email protected]> | 2016-05-06 13:30:44 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-05-06 13:30:44 -0400 |
| commit | 701720a0f802c20d283c197aa7ea9a74f628c0cb (patch) | |
| tree | 956e7ff58a4dcd2ab503e7653b0dc7670ca3e140 /discord/client.py | |
| parent | Suppress ConnectionClosed on sending in the main websocket. (diff) | |
| download | discord.py-701720a0f802c20d283c197aa7ea9a74f628c0cb.tar.xz discord.py-701720a0f802c20d283c197aa7ea9a74f628c0cb.zip | |
Add a TimeoutError if VoiceClient.connect fails.
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py index 3d7b8afa..f56f84bf 100644 --- a/discord/client.py +++ b/discord/client.py @@ -2450,7 +2450,16 @@ class Client: } voice = VoiceClient(**kwargs) - yield from voice.connect() + try: + yield from voice.connect() + except asyncio.TimeoutError as e: + try: + yield from voice.disconnect() + except: + # we don't care if disconnect failed because connection failed + pass + raise e # re-raise + self.connection._add_voice_client(server.id, voice) return voice |