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 @@ -269,11 +269,13 @@ 'ConduitAPI_user_query_Method' => 'applications/people/conduit/ConduitAPI_user_query_Method.php', 'ConduitAPI_user_removestatus_Method' => 'applications/people/conduit/ConduitAPI_user_removestatus_Method.php', 'ConduitAPI_user_whoami_Method' => 'applications/people/conduit/ConduitAPI_user_whoami_Method.php', + 'ConduitApplicationNotInstalledException' => 'applications/conduit/protocol/exception/ConduitApplicationNotInstalledException.php', 'ConduitCall' => 'applications/conduit/call/ConduitCall.php', 'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php', 'ConduitConnectionGarbageCollector' => 'applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php', - 'ConduitException' => 'applications/conduit/protocol/ConduitException.php', + 'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php', 'ConduitLogGarbageCollector' => 'applications/conduit/garbagecollector/ConduitLogGarbageCollector.php', + 'ConduitMethodNotFoundException' => 'applications/conduit/protocol/exception/ConduitMethodNotFoundException.php', 'ConduitSSHWorkflow' => 'applications/conduit/ssh/ConduitSSHWorkflow.php', 'ConpherenceActionMenuEventListener' => 'applications/conpherence/events/ConpherenceActionMenuEventListener.php', 'ConpherenceConfigOptions' => 'applications/conpherence/config/ConpherenceConfigOptions.php', @@ -2999,10 +3001,12 @@ 'ConduitAPI_user_query_Method' => 'ConduitAPI_user_Method', 'ConduitAPI_user_removestatus_Method' => 'ConduitAPI_user_Method', 'ConduitAPI_user_whoami_Method' => 'ConduitAPI_user_Method', + 'ConduitApplicationNotInstalledException' => 'ConduitMethodNotFoundException', 'ConduitCallTestCase' => 'PhabricatorTestCase', 'ConduitConnectionGarbageCollector' => 'PhabricatorGarbageCollector', 'ConduitException' => 'Exception', 'ConduitLogGarbageCollector' => 'PhabricatorGarbageCollector', + 'ConduitMethodNotFoundException' => 'ConduitException', 'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow', 'ConpherenceActionMenuEventListener' => 'PhabricatorEventListener', 'ConpherenceConfigOptions' => 'PhabricatorApplicationConfigOptions', diff --git a/src/applications/conduit/call/ConduitCall.php b/src/applications/conduit/call/ConduitCall.php --- a/src/applications/conduit/call/ConduitCall.php +++ b/src/applications/conduit/call/ConduitCall.php @@ -179,8 +179,7 @@ // Discard, we provide a more specific exception below. } if (!$ok) { - throw new ConduitException( - "Conduit method '{$method}' does not exist."); + throw new ConduitMethodNotFoundException($method); } $class_info = new ReflectionClass($method_class); @@ -201,9 +200,7 @@ $application = $method->getApplication(); if ($application && !$application->isInstalled()) { $app_name = $application->getName(); - throw new ConduitException( - "Method '{$method_class}' belongs to application '{$app_name}', ". - "which is not installed."); + throw new ConduitApplicationNotInstalledException($method, $app_name); } return $method; diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -104,7 +104,9 @@ list($error_code, $error_info) = $auth_error; } } catch (Exception $ex) { - phlog($ex); + if (!($ex instanceof ConduitMethodNotFoundException)) { + phlog($ex); + } $result = null; $error_code = ($ex instanceof ConduitException ? 'ERR-CONDUIT-CALL' diff --git a/src/applications/conduit/protocol/exception/ConduitApplicationNotInstalledException.php b/src/applications/conduit/protocol/exception/ConduitApplicationNotInstalledException.php new file mode 100644 --- /dev/null +++ b/src/applications/conduit/protocol/exception/ConduitApplicationNotInstalledException.php @@ -0,0 +1,14 @@ +errorDescription = $error_description; return $this; } @@ -22,7 +25,7 @@ * * @return string|null Error description, if one is available. */ - public function getErrorDescription() { + final public function getErrorDescription() { return $this->errorDescription; } diff --git a/src/applications/conduit/protocol/exception/ConduitMethodNotFoundException.php b/src/applications/conduit/protocol/exception/ConduitMethodNotFoundException.php new file mode 100644 --- /dev/null +++ b/src/applications/conduit/protocol/exception/ConduitMethodNotFoundException.php @@ -0,0 +1,12 @@ +