Add a TimeoutError if VoiceClient.connect fails.

This commit is contained in:
Rapptz
2016-05-06 13:30:44 -04:00
parent 570ccbf753
commit 701720a0f8
2 changed files with 11 additions and 2 deletions

View File

@ -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