pycord-v3 icon indicating copy to clipboard operation
pycord-v3 copied to clipboard

Remove InvalidArgument infavour of builtin TypeError & ValueError

Open Soheab opened this issue 4 months ago • 0 comments

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 (TypeError or ValueError depending 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

Soheab avatar Nov 07 '25 17:11 Soheab