@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.

Conduit: Improve error handling calling phid.lookup without names

Summary:
Avoid an ugly TypeError exception. Throw a proper error code instead.

```
EXCEPTION: (TypeError) PhabricatorObjectQuery::withNames(): Argument #1 ($names) must be of type array, null given, called in /var/www/html/phorge/phorge/src/applications/phid/conduit/PHIDLookupConduitAPIMethod.php on line 28 at [<phorge>/src/applications/phid/query/PhabricatorObjectQuery.php:17]
```

Closes T16440

Test Plan: Go to http://phorge.localhost/conduit/method/phid.lookup/ and press "Call Method"

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16440

Differential Revision: https://we.phorge.it/D26643

+10
+10
src/applications/phid/conduit/PHIDLookupConduitAPIMethod.php
··· 20 20 return 'nonempty dict<string, wild>'; 21 21 } 22 22 23 + protected function defineErrorTypes() { 24 + return array( 25 + 'ERR-INVALID-PARAMETER' => pht('Must pass names.'), 26 + ); 27 + } 28 + 23 29 protected function execute(ConduitAPIRequest $request) { 24 30 $names = $request->getValue('names'); 31 + 32 + if (!$names) { 33 + throw new ConduitException('ERR-INVALID-PARAMETER'); 34 + } 25 35 26 36 $query = id(new PhabricatorObjectQuery()) 27 37 ->setViewer($request->getUser())