Skip to content

Fix exception handling for help channel pins #1081

@MarkKoz

Description

@MarkKoz

Sentry Issue: BOT-7J

Discord's API returns a 400 with error code 10008 rather than returning a 404 (AKA NotFound), which is currently being caught. An unhanded error here means some stuff for tracking stats doesn't get set.

HTTPException: 400 Bad Request (error code: 10008): Unknown Message
  File "discord/client.py", line 304, in _run_event
    await coro(*args, **kwargs)
  File "bot/cogs/help_channels.py", line 701, in on_message
    await message.pin()
  File "discord/message.py", line 885, in pin
    await self._state.http.pin_message(self.channel.id, self.id, reason=reason)
  File "discord/http.py", line 225, in request
    raise HTTPException(r, data)

Unhandled exception in on_message.

Metadata

Metadata

Assignees

No one assigned

    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