diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -125,6 +125,7 @@ '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', @@ -308,6 +309,7 @@ 'ArcanistMercurialParserTestCase' => 'ArcanistTestCase', 'ArcanistMergeConflictLinter' => 'ArcanistLinter', 'ArcanistMergeConflictLinterTestCase' => 'ArcanistArcanistLinterTestCase', + 'ArcanistMissingLinterException' => 'Exception', 'ArcanistNoEffectException' => 'ArcanistUsageException', 'ArcanistNoEngineException' => 'ArcanistUsageException', 'ArcanistNoLintLinter' => 'ArcanistLinter', diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php --- a/src/lint/linter/ArcanistExternalLinter.php +++ b/src/lint/linter/ArcanistExternalLinter.php @@ -265,7 +265,7 @@ 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.', @@ -273,7 +273,7 @@ get_class($this))); } if (!Filesystem::pathExists($binary)) { - throw new ArcanistUsageException( + throw new ArcanistMissingLinterException( sprintf( "%s\n%s", pht( @@ -287,7 +287,7 @@ } } else { if (!Filesystem::binaryExists($binary)) { - throw new ArcanistUsageException( + throw new ArcanistMissingLinterException( sprintf( "%s\n%s", pht( diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php --- a/src/lint/linter/ArcanistJSHintLinter.php +++ b/src/lint/linter/ArcanistJSHintLinter.php @@ -148,7 +148,7 @@ 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}"); diff --git a/src/lint/linter/ArcanistMissingLinterException.php b/src/lint/linter/ArcanistMissingLinterException.php new file mode 100644 --- /dev/null +++ b/src/lint/linter/ArcanistMissingLinterException.php @@ -0,0 +1,3 @@ +assertTrue( $version !== false, pht('Failed to parse version from command.')); - } catch (ArcanistUsageException $ex) { + } catch (ArcanistMissingLinterException $ex) { $this->assertSkipped($ex->getMessage()); } } diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php --- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php @@ -145,13 +145,15 @@ 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".