mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Provide a separate error code for invalid Conduit calls
Summary: I plan to use this in Arcanist. Test Plan: $ echo '{}' | arc call-conduit x Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4192
This commit is contained in:
parent
d2cf71c5b1
commit
a0e93fd4c4
2 changed files with 5 additions and 3 deletions
|
@ -70,13 +70,13 @@ final class ConduitCall {
|
|||
// Discard, we provide a more specific exception below.
|
||||
}
|
||||
if (!$ok) {
|
||||
throw new Exception(
|
||||
throw new ConduitException(
|
||||
"Conduit method '{$method}' does not exist.");
|
||||
}
|
||||
|
||||
$class_info = new ReflectionClass($method_class);
|
||||
if ($class_info->isAbstract()) {
|
||||
throw new Exception(
|
||||
throw new ConduitException(
|
||||
"Method '{$method}' is not valid; the implementation is an abstract ".
|
||||
"base class.");
|
||||
}
|
||||
|
|
|
@ -108,7 +108,9 @@ final class PhabricatorConduitAPIController
|
|||
} catch (Exception $ex) {
|
||||
phlog($ex);
|
||||
$result = null;
|
||||
$error_code = 'ERR-CONDUIT-CORE';
|
||||
$error_code = ($ex instanceof ConduitException
|
||||
? 'ERR-CONDUIT-CALL'
|
||||
: 'ERR-CONDUIT-CORE');
|
||||
$error_info = $ex->getMessage();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue