This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Throw concurrent.futures.TimeoutError instead of concurrent.futures.__base.TimeoutError
Type: Stage:
Components: asyncio, Library (Lib) Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Decorater, gvanrossum, yselivanov
Priority: normal Keywords:

Created on 2016-11-30 01:52 by Decorater, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (6)
msg282057 - (view) Author: Decorater (Decorater) * Date: 2016-11-30 01:52
So, concurrent.futures.TimeoutError subclasses concurrent.futures.__base.TimeoutError. Why not have asyncio throw that instead of the __base class for Timeout Error?

There is a huge issue with this for starters for those know knows this they cannot handle it easily without having to use that private class in the Error handler which is totally unclean practice.

It is also unclean to raise that exception in asyncio at least change it to concurrent.futures.TimeoutError or asyncio.TimeoutError.

This change would be much beneficial for projects that has to handle as many exceptions as possible to tell the end user that an exception happens custom based on what was thrown.

With this it could benefit everyone who use the parts of asyncio that can throw such exceptions.

I hope you guys would agree with my idea to clean up the parts of asyncio that throws these as it becomes tricky if people don't like to use private functions of another python code file in the standard library in their code or even as little as possible.

It happens in python versions from 3.4 to 3.5.2 and can get annoying.
msg282058 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-11-30 02:07
concurrent.futures.TimeoutError and concurrent.futures.__base.TimeoutError are the same class. So there is nothing to do here.
msg282059 - (view) Author: Decorater (Decorater) * Date: 2016-11-30 02:09
I handle concurrent.futures.TimeoutError on my coroutine that is fired with create_task yet it sitll don't handle it though... so it still is a issue....
msg282060 - (view) Author: Decorater (Decorater) * Date: 2016-11-30 02:11
Here is my corouytine and the traceback on it to verify my issue too:

Task exception was never retrieved
future: <Task finished coro=<VoiceBotCommands.__load() done, defined at E:\Users\Elsword\Desktop\DecoraterBot\Async\resources\Dependencies\DecoraterBotCore\commands\botvoicecommands.py:242> exception=TimeoutError()>
Traceback (most recent call last):
  File "asyncio\tasks.py", line 239, in _step
  File "E:\Users\Elsword\Desktop\DecoraterBot\Async\resources\Dependencies\DecoraterBotCore\commands\botvoicecommands.py", line 257, in __load
    self.voice = yield from self.bot.join_voice_channel(self.vchannel)
  File "discord\client.py", line 3166, in join_voice_channel
  File "asyncio\tasks.py", line 396, in wait_for
concurrent.futures._base.TimeoutError

    @async
    def __load(self):
        """
        Makes bot able to join a voice channel when the commands are loaded.
        """
        try:
            vchannel_2 = str(self.botvoicechannel['Bot_Current_Voice_Channel'][0])
            vmserver = str(self.botvoicechannel['Bot_Current_Voice_Channel'][1])
            vmchannel = str(self.botvoicechannel['Bot_Current_Voice_Channel'][2])
            self.voice_message_server_name = str(self.botvoicechannel['Bot_Current_Voice_Channel'][3])
            self.vchannel_name = str(self.botvoicechannel['Bot_Current_Voice_Channel'][4])
            self.vchannel = discord.Object(id=vchannel_2)
            self.voice_message_server = discord.Object(id=vmserver)
            self.voice_message_channel = discord.Object(id=vmchannel)
            try:
                self.voice = yield from self.bot.join_voice_channel(self.vchannel)
                self.verror = False
            except discord.errors.ConnectionClosed:
                pass
            except discord.errors.InvalidArgument:
                self.voice_message_server_name = None
                self.vchannel_name = None
                self.vchannel = None
                self.voice_message_server = None
                self.voice_message_channel = None
                self.voice = None
                self.verror = True
            except BotErrors.CommandTimeoutError:
                yield from self.bot.send_message(self.voice_message_channel,
                                                 content=str(
                                                     self.bot.botmessages['reload_commands_voice_channels_bypass2'][0]))
                self.voice_message_server_name = None
                self.vchannel_name = None
                self.vchannel = None
                self.voice_message_server = None
                self.voice_message_channel = None
                self.voice = None
                self.verror = True
            except RuntimeError:
                self.voice_message_server_name = None
                self.vchannel_name = None
                self.vchannel = None
                self.voice_message_server = None
                self.voice = None
                self.verror = True
                msgdata = str(self.bot.botmessages['reload_commands_voice_channels_bypass2'][1])
                yield from self.bot.send_message(self.voice_message_channel, content=msgdata)
                self.voice_message_channel = None
            if self.verror is not True:
                message_data = str(self.bot.botmessages['reload_commands_voice_channels_bypass2'][2]).format(
                    self.vchannel_name)
                yield from self.bot.send_message(self.voice_message_channel, content=message_data)
        except IndexError:
            self.voice_message_server_name = None
            self.vchannel_name = None
            self.vchannel = None
            self.voice_message_server = None
            self.voice_message_channel = None
            self.voice = None
        except discord.errors.ClientException:
            pass  # already in a voice channel so lots not set those values to None.
msg282061 - (view) Author: Decorater (Decorater) * Date: 2016-11-30 02:12
oh wait nvm
msg282062 - (view) Author: Decorater (Decorater) * Date: 2016-11-30 02:13
Wait actually BotErrors.CommandTimeoutError cubaclasses concurrent.futures.TimeoutError
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73022
2016-11-30 02:13:48Decoratersetmessages: + msg282062
2016-11-30 02:12:20Decoratersetmessages: + msg282061
2016-11-30 02:11:31Decoratersetmessages: + msg282060
2016-11-30 02:09:13Decoratersetmessages: + msg282059
2016-11-30 02:07:35gvanrossumsetstatus: open -> closed
resolution: rejected
messages: + msg282058
2016-11-30 01:52:58Decoratercreate