pycord-v3
pycord-v3 copied to clipboard
Remove InvalidArgument infavour of builtin TypeError & ValueError
InvalidArgument currently duplicates behavior that is already covered by the built-in exceptions TypeError and ValueError. In most cases across the codebase, the situations where InvalidArgument is raised are either:
- Incorrect types → should be
TypeError - Incorrect values (but correct type) → should be
ValueError
Because Python already provides a clear semantic split here, InvalidArgument adds no meaningful benefit and instead introduces inconsistency in error patterns across the library.
Proposal
- Remove
InvalidArgument - Replace existing uses with the appropriate built-in exception (
TypeErrororValueErrordepending on context) - Update documentation and type hints accordingly
Benefits
- Aligns with standard Python exception semantics
- Improves clarity for users handling exceptions
- Reduces surface area of the public API