mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-29 08:50:57 +01:00
Clean up push failure messaging in "arc land" slightly
Summary: Ref PHI1808. Currently, push failures are messaged awkwardly. Make this exception handling more selective and the user-facing behavior more readable. Test Plan: Ran "arc land" against a failing remote, saw a human-readable message instead of a stack trace. Differential Revision: https://secure.phabricator.com/D21395
This commit is contained in:
parent
710bceab10
commit
3633364bb9
5 changed files with 12 additions and 11 deletions
|
@ -307,6 +307,7 @@ phutil_register_library_map(array(
|
|||
'ArcanistLandCommit' => 'land/ArcanistLandCommit.php',
|
||||
'ArcanistLandCommitSet' => 'land/ArcanistLandCommitSet.php',
|
||||
'ArcanistLandEngine' => 'land/engine/ArcanistLandEngine.php',
|
||||
'ArcanistLandPushFailureException' => 'land/exception/ArcanistLandPushFailureException.php',
|
||||
'ArcanistLandSymbol' => 'land/ArcanistLandSymbol.php',
|
||||
'ArcanistLandTarget' => 'land/ArcanistLandTarget.php',
|
||||
'ArcanistLandWorkflow' => 'workflow/ArcanistLandWorkflow.php',
|
||||
|
@ -1352,6 +1353,7 @@ phutil_register_library_map(array(
|
|||
'ArcanistLandCommit' => 'Phobject',
|
||||
'ArcanistLandCommitSet' => 'Phobject',
|
||||
'ArcanistLandEngine' => 'ArcanistWorkflowEngine',
|
||||
'ArcanistLandPushFailureException' => 'Exception',
|
||||
'ArcanistLandSymbol' => 'Phobject',
|
||||
'ArcanistLandTarget' => 'Phobject',
|
||||
'ArcanistLandWorkflow' => 'ArcanistArcWorkflow',
|
||||
|
|
|
@ -491,7 +491,7 @@ final class ArcanistGitLandEngine
|
|||
$flags_argv,
|
||||
$into_commit);
|
||||
if ($err) {
|
||||
throw new ArcanistUsageException(
|
||||
throw new ArcanistLandPushFailureException(
|
||||
pht(
|
||||
'Submit failed! Fix the error and run "arc land" again.'));
|
||||
}
|
||||
|
@ -509,16 +509,10 @@ final class ArcanistGitLandEngine
|
|||
$this->newOntoRefArguments($into_commit));
|
||||
|
||||
if ($err) {
|
||||
throw new ArcanistUsageException(
|
||||
throw new ArcanistLandPushFailureException(
|
||||
pht(
|
||||
'Push failed! Fix the error and run "arc land" again.'));
|
||||
}
|
||||
|
||||
// TODO
|
||||
// if ($this->isGitSvn) {
|
||||
// $err = phutil_passthru('git svn dcommit');
|
||||
// $cmd = 'git svn dcommit';
|
||||
|
||||
}
|
||||
|
||||
protected function reconcileLocalState(
|
||||
|
|
|
@ -1259,7 +1259,7 @@ abstract class ArcanistLandEngine
|
|||
try {
|
||||
$this->pushChange($into_commit);
|
||||
$this->setHasUnpushedChanges(false);
|
||||
} catch (Exception $ex) {
|
||||
} catch (ArcanistLandPushFailureException $ex) {
|
||||
|
||||
// TODO: If the push fails, fetch and retry if the remote ref
|
||||
// has moved ahead of us.
|
||||
|
@ -1280,7 +1280,8 @@ abstract class ArcanistLandEngine
|
|||
continue;
|
||||
}
|
||||
|
||||
throw $ex;
|
||||
throw new PhutilArgumentUsageException(
|
||||
$ex->getMessage());
|
||||
}
|
||||
|
||||
if ($need_cascade) {
|
||||
|
|
|
@ -836,7 +836,7 @@ final class ArcanistMercurialLandEngine
|
|||
foreach ($body as $command) {
|
||||
$err = $this->newPassthru('%Ls', $command);
|
||||
if ($err) {
|
||||
throw new ArcanistUsageException(
|
||||
throw new ArcanistLandPushFailureException(
|
||||
pht(
|
||||
'Push failed! Fix the error and run "arc land" again.'));
|
||||
}
|
||||
|
|
4
src/land/exception/ArcanistLandPushFailureException.php
Normal file
4
src/land/exception/ArcanistLandPushFailureException.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
final class ArcanistLandPushFailureException
|
||||
extends Exception {}
|
Loading…
Reference in a new issue