vid-queue/app/Commands/Command.php

23 lines
575 B
PHP
Raw Permalink Normal View History

2022-03-03 22:55:57 -06:00
<?php
namespace App\Commands;
use App\Exceptions\Quit;
use LaravelZero\Framework\Commands\Command as BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
abstract class Command extends BaseCommand
{
public function run(InputInterface $input, OutputInterface $output): int
{
try {
return parent::run($input, $output);
} catch (Quit $quit) {
$this->error($quit->getMessage());
return $quit->getCode() > 0 ? $quit->getCode() : 1;
}
}
}