Summary: I feel that we are abusing `ArcanistUsageException`. Throw a more tailed exception instead. Depends on D11197.
Test Plan: `arc lint`, I guess.
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: avivey, Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D11205
'ArcanistMercurialParserTestCase' => 'repository/parser/__tests__/ArcanistMercurialParserTestCase.php',
'ArcanistMergeConflictLinter' => 'lint/linter/ArcanistMergeConflictLinter.php',
'ArcanistMergeConflictLinterTestCase' => 'lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php',
+ 'ArcanistMissingLinterException' => 'lint/linter/ArcanistMissingLinterException.php',
'ArcanistNoEffectException' => 'exception/usage/ArcanistNoEffectException.php',
'ArcanistNoEngineException' => 'exception/usage/ArcanistNoEngineException.php',
'ArcanistNoLintLinter' => 'lint/linter/ArcanistNoLintLinter.php',
'ArcanistMercurialParserTestCase' => 'ArcanistTestCase',
'ArcanistMergeConflictLinter' => 'ArcanistLinter',
'ArcanistMergeConflictLinterTestCase' => 'ArcanistArcanistLinterTestCase',
+ 'ArcanistMissingLinterException' => 'Exception',
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter',
if ($interpreter) {
if (!Filesystem::binaryExists($interpreter)) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
pht(
'Unable to locate interpreter "%s" to run linter %s. You may need '.
'to install the interpreter, or adjust your linter configuration.',
get_class($this)));
}
if (!Filesystem::pathExists($binary)) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
sprintf(
"%s\n%s",
pht(
}
} else {
if (!Filesystem::binaryExists($binary)) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
sprintf(
"%s\n%s",
pht(
if (!is_array($errors)) {
// Something went wrong and we can't decode the output. Exit abnormally.
- throw new ArcanistUsageException(
+ throw new RuntimeException(
"JSHint returned unparseable output.\n".
"stdout:\n\n{$stdout}".
"stderr:\n\n{$stderr}");
--- /dev/null
+<?php
+
+final class ArcanistMissingLinterException extends Exception {}
list($err) = exec_manual('which %s', $pylint_bin);
if ($err) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
"PyLint does not appear to be installed on this system. Install it ".
"(e.g., with 'sudo easy_install pylint') or configure ".
"'lint.pylint.prefix' in your .arcconfig to point to the directory ".
$this->assertTrue(
$version !== false,
pht('Failed to parse version from command.'));
- } catch (ArcanistUsageException $ex) {
+ } catch (ArcanistMissingLinterException $ex) {
$this->assertSkipped($ex->getMessage());
}
}
if ($exception instanceof PhutilAggregateException) {
$caught_exception = false;
foreach ($exception->getExceptions() as $ex) {
- if ($ex instanceof ArcanistUsageException) {
+ if ($ex instanceof ArcanistUsageException ||
+ $ex instanceof ArcanistMissingLinterException) {
$this->assertSkipped($ex->getMessage());
} else {
$caught_exception = true;
}
}
- } else if ($exception instanceof ArcanistUsageException) {
+ } else if ($exception instanceof ArcanistUsageException ||
+ $exception instanceof ArcanistMissingLinterException) {
$this->assertSkipped($exception->getMessage());
}
$exception_message = $exception->getMessage()."\n\n".