@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 flag.edit without objectPHID

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

```
EXCEPTION: (AphrontQueryException) #1048: Column 'objectPHID' cannot be null at [<phorge>/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:396]
```

Closes T16442

Test Plan: Go to http://phorge.localhost/conduit/method/flag.edit/ and press the "Call Method" button

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

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

Maniphest Tasks: T16442

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

+9
+9
src/applications/flag/conduit/FlagEditConduitAPIMethod.php
··· 22 22 return 'dict'; 23 23 } 24 24 25 + protected function defineErrorTypes() { 26 + return array( 27 + 'ERR-BAD-PHID' => pht('Must pass a PHID.'), 28 + ); 29 + } 30 + 25 31 protected function execute(ConduitAPIRequest $request) { 26 32 $user = $request->getUser()->getPHID(); 27 33 $phid = $request->getValue('objectPHID'); 34 + if ($phid === null) { 35 + throw new ConduitException('ERR-BAD-PHID'); 36 + } 28 37 $new = false; 29 38 30 39 $flag = id(new PhabricatorFlag())->loadOneWhere(