Skip to content

Clean: _delete_found doesn't handle NotFound #1963

@sentry

Description

@sentry

The _delete_found doesn't properly handle the NotFound exception, a contextlib.suppress block should be added to prevent the exception from propagating.

Sentry Issue: BOT-1QH

NotFound: 404 Not Found (error code: 10008): Unknown Message
  File "discord/http.py", line 331, in request
    raise NotFound(response, data)
  File "discord/channel.py", line 403, in delete_messages
    await self._state.http.delete_message(self.id, message_id)
  File "bot/exts/moderation/clean.py", line 296, in _delete_found
    await channel.delete_messages(to_delete)
  File "bot/exts/moderation/clean.py", line 408, in _clean_messages
    deleted_messages = await self._delete_found(message_mappings)
  File "bot/exts/moderation/clean.py", line 480, in clean_user
    await self._clean_messages(ctx, traverse, users=[user], channels=channels, use_cache=use_cache)
...
(1 additional frame(s) were not displayed)

Error executing command invoked by [REDACTED]: !clean user [REDACTED] 20 0 *

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: utilityRelated to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils)good first issueGood for newcomersp: 2 - normalNormal Priorityt: 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