mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-27 01:02:41 +01:00
[Wilds] Slightly simplify fatal handling during "arc" setup
Summary: Ref T13098. We currently handle fatals by printing a message and returning an error code, since this was the most direct adaptation from the old `arcanist.php` script. Instead, throw an exception and then handle it above, since we can reasonably do that in one place now. Test Plan: Ran `arc`. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13098 Differential Revision: https://secure.phabricator.com/D19693
This commit is contained in:
parent
fe0c293895
commit
9a94aa216b
1 changed files with 12 additions and 14 deletions
|
@ -3,9 +3,14 @@
|
|||
final class ArcanistRuntime {
|
||||
|
||||
public function execute(array $argv) {
|
||||
$err = $this->checkEnvironment();
|
||||
if ($err) {
|
||||
return $err;
|
||||
|
||||
try {
|
||||
$this->checkEnvironment();
|
||||
} catch (Exception $ex) {
|
||||
echo "CONFIGURATION ERROR\n\n";
|
||||
echo $ex->getMessage();
|
||||
echo "\n\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
PhutilTranslator::getInstance()
|
||||
|
@ -109,7 +114,8 @@ final class ArcanistRuntime {
|
|||
'minimum supported version ("%s"). Update PHP to continue.',
|
||||
$cur_version,
|
||||
$min_version);
|
||||
return $this->fatalError($message);
|
||||
|
||||
throw new Exception($message);
|
||||
}
|
||||
|
||||
if ($is_windows) {
|
||||
|
@ -190,17 +196,9 @@ final class ArcanistRuntime {
|
|||
$problems[] = "PHP was built with this configure command:\n\n{$config}";
|
||||
}
|
||||
$problems = implode("\n\n", $problems);
|
||||
return $this->fatalError($problems);
|
||||
|
||||
throw new Exception($problems);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function fatalError($message) {
|
||||
echo "CONFIGURATION ERROR\n\n";
|
||||
echo $message;
|
||||
echo "\n\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
private function loadConfiguration(PhutilArgumentParser $args) {
|
||||
|
|
Loading…
Reference in a new issue