Skip to content

[DX][Console] Use specific exception classes for not defined and ambiguous command names #14873

@GromNaN

Description

@GromNaN

The method Console\Application::find can throw an \InvalidArgumentException when the command name typed is not defined or ambiguous.

To avoid having such exception logged into my alert system I want to filter on these exceptions. But the class \InvalidArgumentException is too generic.

What about creating a domain specific class: Symfony\Component\Console\Exception\CommandNotDefinedException extending \InvalidArgumentException ?

As a bonus, this exception class would have an extra property $alternatives to store the suggested command names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions