Skip to content

Remove InvalidArgument infavour of builtin TypeError & ValueError #186

@Soheab

Description

@Soheab

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

Metadata

Metadata

Assignees

Labels

pyepPYcord Enhancement Proposal

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions