Skip to content

Fix Error Handler#109

Open
PenguinBoi12 wants to merge 4 commits into
mainfrom
fix/error-handler
Open

Fix Error Handler#109
PenguinBoi12 wants to merge 4 commits into
mainfrom
fix/error-handler

Conversation

@PenguinBoi12

@PenguinBoi12 PenguinBoi12 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Description

Error handlers (@bot.error, @ext.error, @cmd.error) only matched the exact exception type, so handlers registered for a base class (or the default @bot.error() fallback) silently never fired for subclasses. Extension/bot-level command error
handlers also never ran for exceptions raised inside a command body.

Additionally, once an error was handled, the command would still send a generic "usage: ..." message and log it as unhandled.

This PR:

  • Matches errors by walking the exception's MRO instead of exact-type lookup
  • Stops double-handling

Type of Change

  • Feature
  • Refactor
  • Bug fix
  • Documentation
  • Other: ___

Pre-merge Checklist

  • Run tests: pytest
  • Run type check: mypy
  • Run formatting: `black .

@PenguinBoi12 PenguinBoi12 self-assigned this Jul 5, 2026
@PenguinBoi12 PenguinBoi12 changed the title Fix/error handler Fix Error Handler Jul 6, 2026
@PenguinBoi12 PenguinBoi12 marked this pull request as ready for review July 7, 2026 06:15
@PenguinBoi12 PenguinBoi12 requested a review from chrisdedman July 7, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant