Skip to content

Switch to a custom exception instead of InvalidArgumentException #202

Description

@githoober

This library should have its own AssertException to avoid a need to:

  • override reportInvalidArgument method - a dubious solution as it breaks userland Psalm checks because each assert method still has a tag "@throws InvalidArgumentException". Plus, not every single assert check is associated with some invalid parameters. Some checks, for example, run against function results.
  • to catch InvalidArgumentException and convert it to some other exceptions because it collides with InvalidArgumentException coming from elsewhere. This prevents proper exception translation between application layers.

I realize this a BC break, but this issue is too serious to keep ignoring. At least a few tickets related to this problem were closed without any resolution and people will continue fighting it again in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions