Skip to content

Commit 3924621

Browse files
committed
update some for handle error
1 parent f92f411 commit 3924621

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Component/ErrorHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use Inhere\Console\AbstractApplication;
1212
use Inhere\Console\Contract\ErrorHandlerInterface;
13-
use Inhere\Console\Exception\PromptException;
13+
use InvalidArgumentException;
1414
use Throwable;
1515
use Toolkit\Cli\Util\Highlighter;
1616
use function file_get_contents;
@@ -30,7 +30,7 @@ class ErrorHandler implements ErrorHandlerInterface
3030
*/
3131
public function handle(Throwable $e, AbstractApplication $app): void
3232
{
33-
if ($e instanceof PromptException) {
33+
if ($e instanceof InvalidArgumentException) {
3434
$app->getOutput()->error($e->getMessage());
3535
return;
3636
}
@@ -69,7 +69,7 @@ public function handle(Throwable $e, AbstractApplication $app): void
6969
}
7070

7171
// simple output
72-
$app->getOutput()->error('An error occurred! - ' . $e->getMessage());
72+
$app->getOutput()->error($e->getMessage() ?: 'unknown error');
7373
$app->write("\nYou can use '--debug 4' to see error details.");
7474
}
7575
}

0 commit comments

Comments
 (0)