Skip to content

Commit

Permalink
Show error trace
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Nov 29, 2023
1 parent 303d34f commit d26656c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function command(...$args): void
try {
$cli->run(...$args);
} catch (Throwable $e) {
$cli->error($e->getMessage());
$cli->error((string)$e);
}
}

Expand Down
7 changes: 4 additions & 3 deletions tests/CLI/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Kirby\CLI;

use Exception;
use League\CLImate\CLImate;

/**
Expand Down Expand Up @@ -169,7 +170,7 @@ public function testLoadInvalidCommand()
{
$cli = new CLI();

$this->expectException('Exception');
$this->expectException(Exception::class);
$this->expectExceptionMessage('The command does not exist');

$cli->load('foo');
Expand All @@ -182,7 +183,7 @@ public function testLoadInvalidCommandAction()
{
$cli = new CLI();

$this->expectException('Exception');
$this->expectException(Exception::class);
$this->expectExceptionMessage('The command does not define a command action');

$cli->load('invalid-action');
Expand All @@ -195,7 +196,7 @@ public function testLoadInvalidCommandFormat()
{
$cli = new CLI();

$this->expectException('Exception');
$this->expectException(Exception::class);
$this->expectExceptionMessage('Invalid command format. The command must be defined as array');

$cli->load('invalid-format');
Expand Down

0 comments on commit d26656c

Please sign in to comment.