diff --git a/scripts/arcanist.php b/scripts/arcanist.php index f6a41de3..64938ede 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -319,26 +319,28 @@ try { $config->didRunWorkflow($command, $workflow, $err); exit((int)$err); -} catch (ArcanistUsageException $ex) { - echo phutil_console_format( - "**Usage Exception:** %s\n", - $ex->getMessage()); +} catch (Exception $ex) { + $is_usage = ($ex instanceof ArcanistUsageException); + if ($is_usage) { + echo phutil_console_format( + "**Usage Exception:** %s\n", + $ex->getMessage()); + } + + $config->didAbortWorkflow($command, $workflow, $ex); + if ($config_trace_mode) { echo "\n"; throw $ex; } - exit(1); -} catch (Exception $ex) { - if ($config_trace_mode) { - throw $ex; + if (!$is_usage) { + echo phutil_console_format( + "**Exception**\n%s\n%s\n", + $ex->getMessage(), + "(Run with --trace for a full exception trace.)"); } - echo phutil_console_format( - "**Exception**\n%s\n%s\n", - $ex->getMessage(), - "(Run with --trace for a full exception trace.)"); - exit(1); } diff --git a/src/configuration/ArcanistConfiguration.php b/src/configuration/ArcanistConfiguration.php index 696b8e77..f8af6909 100644 --- a/src/configuration/ArcanistConfiguration.php +++ b/src/configuration/ArcanistConfiguration.php @@ -29,7 +29,7 @@ * - create, replace, or disable workflows by overriding buildWorkflow() * and buildAllWorkflows(); * - add additional steps before or after workflows run by overriding - * willRunWorkflow() or didRunWorkflow(); and + * willRunWorkflow() or didRunWorkflow() or didAbortWorkflow(); and * - add new flags to existing workflows by overriding * getCustomArgumentsForCommand(). * @@ -93,6 +93,14 @@ class ArcanistConfiguration { // This is a hook. } + public function didAbortWorkflow( + $command, + ArcanistBaseWorkflow $workflow, + Exception $ex) { + + // This is a hook. + } + public function getCustomArgumentsForCommand($command) { return array(); }