Skip to content

Fix/error handler#109

Draft
PenguinBoi12 wants to merge 2 commits into
mainfrom
fix/error-handler
Draft

Fix/error handler#109
PenguinBoi12 wants to merge 2 commits into
mainfrom
fix/error-handler

Conversation

@PenguinBoi12

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant