@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+18 -11
+2
src/__phutil_library_map__.php
··· 130 130 'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php', 131 131 'ConduitGetCertificateConduitAPIMethod' => 'applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php', 132 132 'ConduitLogGarbageCollector' => 'applications/conduit/garbagecollector/ConduitLogGarbageCollector.php', 133 + 'ConduitMethodDoesNotExistException' => 'applications/conduit/protocol/exception/ConduitMethodDoesNotExistException.php', 133 134 'ConduitMethodNotFoundException' => 'applications/conduit/protocol/exception/ConduitMethodNotFoundException.php', 134 135 'ConduitPingConduitAPIMethod' => 'applications/conduit/method/ConduitPingConduitAPIMethod.php', 135 136 'ConduitQueryConduitAPIMethod' => 'applications/conduit/method/ConduitQueryConduitAPIMethod.php', ··· 2872 2873 'ConduitException' => 'Exception', 2873 2874 'ConduitGetCertificateConduitAPIMethod' => 'ConduitAPIMethod', 2874 2875 'ConduitLogGarbageCollector' => 'PhabricatorGarbageCollector', 2876 + 'ConduitMethodDoesNotExistException' => 'ConduitMethodNotFoundException', 2875 2877 'ConduitMethodNotFoundException' => 'ConduitException', 2876 2878 'ConduitPingConduitAPIMethod' => 'ConduitAPIMethod', 2877 2879 'ConduitQueryConduitAPIMethod' => 'ConduitAPIMethod',
+1 -1
src/applications/conduit/call/ConduitCall.php
··· 172 172 $method = ConduitAPIMethod::getConduitMethod($method_name); 173 173 174 174 if (!$method) { 175 - throw new ConduitMethodNotFoundException($method_name); 175 + throw new ConduitMethodDoesNotExistException($method_name); 176 176 } 177 177 178 178 $application = $method->getApplication();
+2 -2
src/applications/conduit/protocol/exception/ConduitApplicationNotInstalledException.php
··· 3 3 final class ConduitApplicationNotInstalledException 4 4 extends ConduitMethodNotFoundException { 5 5 6 - public function __construct($method, $application) { 6 + public function __construct(ConduitAPIMethod $method, $application) { 7 7 parent::__construct( 8 8 pht( 9 9 "Method '%s' belongs to application '%s', which is not installed.", 10 - $method, 10 + $method->getAPIMethodName(), 11 11 $application)); 12 12 } 13 13
+12
src/applications/conduit/protocol/exception/ConduitMethodDoesNotExistException.php
··· 1 + <?php 2 + 3 + final class ConduitMethodDoesNotExistException 4 + extends ConduitMethodNotFoundException { 5 + 6 + public function __construct($method_name) { 7 + parent::__construct( 8 + pht( 9 + 'Conduit API method "%s" does not exist.')); 10 + } 11 + 12 + }
+1 -8
src/applications/conduit/protocol/exception/ConduitMethodNotFoundException.php
··· 1 1 <?php 2 2 3 - /** 4 - * @concrete-extensible 5 - */ 6 - class ConduitMethodNotFoundException extends ConduitException { 7 - 8 - public function __construct($method) { 9 - parent::__construct(pht("Conduit method '%s' does not exist.", $method)); 10 - } 3 + abstract class ConduitMethodNotFoundException extends ConduitException { 11 4 12 5 }