commander
commander copied to clipboard
Add option to ignore exception in route
Currently the code catches any route Exception and the script exits.
public function execArgv(?array $argv = null)
{
try {
$this->handleArgv($argv);
} catch (NoRouteFoundException $e) {
...
} catch (Exception $e) {
fwrite(STDERR, 'Program Error: ' . $e->getMessage() . PHP_EOL);
// stdlib.h: #define EXIT_FAILURE 1
exit(1);
}
}
I would like handle the exception myself and prevent the script from exiting. Are you open to such a change? It could be a Boolean passed in the constructor for example.