Skip to content

Commit

Permalink
update some for handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Aug 25, 2021
1 parent f92f411 commit 3924621
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Component/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use Inhere\Console\AbstractApplication;
use Inhere\Console\Contract\ErrorHandlerInterface;
use Inhere\Console\Exception\PromptException;
use InvalidArgumentException;
use Throwable;
use Toolkit\Cli\Util\Highlighter;
use function file_get_contents;
Expand All @@ -30,7 +30,7 @@ class ErrorHandler implements ErrorHandlerInterface
*/
public function handle(Throwable $e, AbstractApplication $app): void
{
if ($e instanceof PromptException) {
if ($e instanceof InvalidArgumentException) {
$app->getOutput()->error($e->getMessage());
return;
}
Expand Down Expand Up @@ -69,7 +69,7 @@ public function handle(Throwable $e, AbstractApplication $app): void
}

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

0 comments on commit 3924621

Please sign in to comment.