Skip to content

Commit

Permalink
Improve exception handling for argument parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Feb 5, 2024
1 parent 1d6d72f commit fd26c83
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,11 @@ public function run(?string $name = null, ...$args): void
...$args
];

$exception = null;

try {
$this->climate->arguments->parse($argv);
} catch (Throwable $e) {
$exception = $e;
$this->error($e->getMessage());
exit;
}

// enable quiet mode
Expand All @@ -537,10 +536,6 @@ public function run(?string $name = null, ...$args): void
return;
}

if ($exception !== null) {
throw $exception;
}

$command['command']($this);
}

Expand Down

0 comments on commit fd26c83

Please sign in to comment.