You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
…eptions (GromNaN)
This PR was squashed before being merged into the 2.8 branch (closes#14894).
Discussion
----------
[Console] Add domain exceptions to replace generic exceptions
Creates domain specific exception classes for the case where a user type an invalid command name or option name.
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14873
| License | MIT
| Doc PR | N/A
TODO:
* [x] Replace `\InvalidArgumentException` by `Symfony\Component\Console\Exception\InvalidArgumentException`
* [x] Add `Symfony\Component\Console\Exception\ExceptionInterface`
Commits
-------
dd17dc0 [Console] Add domain exceptions to replace generic exceptions
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.The text was updated successfully, but these errors were encountered: