mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Fix string construction in Conduit exceptions
Summary: Fixes T5838. - We currently try to use a `ConduitAPIMethod` object as a string. - We then pass that string to the parent's `__construct()` method as `$message`. Test Plan: Uninstalled Maniphest, then tried to execute `maniphest.createtask`. Got a useful exception message instead of an error during message construction. Reviewers: joshuaspence, btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5838 Differential Revision: https://secure.phabricator.com/D10211
This commit is contained in:
parent
aa67a5ffc8
commit
d09d7ffe1f
5 changed files with 18 additions and 11 deletions
|
@ -130,6 +130,7 @@ phutil_register_library_map(array(
|
|||
'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php',
|
||||
'ConduitGetCertificateConduitAPIMethod' => 'applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php',
|
||||
'ConduitLogGarbageCollector' => 'applications/conduit/garbagecollector/ConduitLogGarbageCollector.php',
|
||||
'ConduitMethodDoesNotExistException' => 'applications/conduit/protocol/exception/ConduitMethodDoesNotExistException.php',
|
||||
'ConduitMethodNotFoundException' => 'applications/conduit/protocol/exception/ConduitMethodNotFoundException.php',
|
||||
'ConduitPingConduitAPIMethod' => 'applications/conduit/method/ConduitPingConduitAPIMethod.php',
|
||||
'ConduitQueryConduitAPIMethod' => 'applications/conduit/method/ConduitQueryConduitAPIMethod.php',
|
||||
|
@ -2872,6 +2873,7 @@ phutil_register_library_map(array(
|
|||
'ConduitException' => 'Exception',
|
||||
'ConduitGetCertificateConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ConduitLogGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||
'ConduitMethodDoesNotExistException' => 'ConduitMethodNotFoundException',
|
||||
'ConduitMethodNotFoundException' => 'ConduitException',
|
||||
'ConduitPingConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
'ConduitQueryConduitAPIMethod' => 'ConduitAPIMethod',
|
||||
|
|
|
@ -172,7 +172,7 @@ final class ConduitCall {
|
|||
$method = ConduitAPIMethod::getConduitMethod($method_name);
|
||||
|
||||
if (!$method) {
|
||||
throw new ConduitMethodNotFoundException($method_name);
|
||||
throw new ConduitMethodDoesNotExistException($method_name);
|
||||
}
|
||||
|
||||
$application = $method->getApplication();
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
final class ConduitApplicationNotInstalledException
|
||||
extends ConduitMethodNotFoundException {
|
||||
|
||||
public function __construct($method, $application) {
|
||||
public function __construct(ConduitAPIMethod $method, $application) {
|
||||
parent::__construct(
|
||||
pht(
|
||||
"Method '%s' belongs to application '%s', which is not installed.",
|
||||
$method,
|
||||
$method->getAPIMethodName(),
|
||||
$application));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
final class ConduitMethodDoesNotExistException
|
||||
extends ConduitMethodNotFoundException {
|
||||
|
||||
public function __construct($method_name) {
|
||||
parent::__construct(
|
||||
pht(
|
||||
'Conduit API method "%s" does not exist.'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @concrete-extensible
|
||||
*/
|
||||
class ConduitMethodNotFoundException extends ConduitException {
|
||||
|
||||
public function __construct($method) {
|
||||
parent::__construct(pht("Conduit method '%s' does not exist.", $method));
|
||||
}
|
||||
abstract class ConduitMethodNotFoundException extends ConduitException {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue