|
20 | 20 | use Deployer\Command\TreeCommand; |
21 | 21 | use Deployer\Command\WorkerCommand; |
22 | 22 | use Deployer\Component\Pimple\Container; |
| 23 | +use Deployer\Exception\SchemaException; |
23 | 24 | use Deployer\Executor\Master; |
24 | 25 | use Deployer\Host\Host; |
25 | 26 | use Deployer\Host\HostCollection; |
@@ -274,18 +275,24 @@ public static function run(string $version, ?string $deployFile): void |
274 | 275 |
|
275 | 276 | public static function printException(OutputInterface $output, Throwable $exception): void |
276 | 277 | { |
277 | | - $class = get_class($exception); |
278 | | - $file = basename($exception->getFile()); |
279 | | - $output->writeln([ |
280 | | - "<fg=white;bg=red> {$class} </> <comment>in {$file} on line {$exception->getLine()}:</>", |
281 | | - "", |
282 | | - implode("\n", array_map(function ($line) { |
283 | | - return " " . $line; |
284 | | - }, explode("\n", $exception->getMessage()))), |
285 | | - "", |
286 | | - ]); |
287 | | - if ($output->isDebug()) { |
288 | | - $output->writeln($exception->getTraceAsString()); |
| 278 | + if ($exception instanceof SchemaException) { |
| 279 | + $output->writeln([ |
| 280 | + "<fg=white;bg=red> Schema error </> {$exception->getMessage()}", |
| 281 | + ]); |
| 282 | + } else { |
| 283 | + $class = get_class($exception); |
| 284 | + $file = basename($exception->getFile()); |
| 285 | + $output->writeln([ |
| 286 | + "<fg=white;bg=red> {$class} </> <comment>in {$file} on line {$exception->getLine()}:</>", |
| 287 | + "", |
| 288 | + implode("\n", array_map(function ($line) { |
| 289 | + return " " . $line; |
| 290 | + }, explode("\n", $exception->getMessage()))), |
| 291 | + "", |
| 292 | + ]); |
| 293 | + if ($output->isDebug()) { |
| 294 | + $output->writeln($exception->getTraceAsString()); |
| 295 | + } |
289 | 296 | } |
290 | 297 |
|
291 | 298 | if ($exception->getPrevious()) { |
|
0 commit comments