Skip to content

DNS issues not handled correctly #74

@ioistired

Description

@ioistired

steps

ec/add abc http://invalid.hostname/example.jpg

expected behavior

"DNS lookup for invalid.hostname fail."

actual behavior

Internal ClientConnectorError is thrown:

traceback

ERROR:bot:  File "/usr/local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 79, in wrapped
     ret = await coro(*args, **kwargs)
   File "/home/bots/ec/emote_collector/extensions/emote.py", line 215, in add
     message = await self.add_safe(name.strip(':;'), url, context.message.author.id)
   File "/home/bots/ec/emote_collector/extensions/emote.py", line 282, in add_safe
     emote = await self.add_from_url(name, url, author_id)
   File "/home/bots/ec/emote_collector/extensions/emote.py", line 302, in add_from_url
     image_data = await self.fetch_emote(url)
   File "/home/bots/ec/emote_collector/extensions/emote.py", line 322, in fetch_emote
     async with self.http.get(url, headers={'Range': range_header}, timeout=5) as response:
   File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1005, in __aenter__
     self._resp = await self._coro
   File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 473, in _request
     conn = await self._connector.connect(
   File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 522, in connect
     proto = await self._create_connection(req, traces, timeout)
   File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 853, in _create_connection
     _, proto = await self._create_direct_connection(
   File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 959, in _create_direct_connection
     raise ClientConnectorError(req.connection_key, exc) from exc
 ERROR:bot:ClientConnectorError: Cannot connect to host invalid.hostname:80 ssl:None [Name or service not known]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions