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

Gracefully fail request if non existing callsign is passed to getrecentcommitsbypath instead of crashing

Summary:
`diffusion.getrecentcommitsbypath` fails with 500 error when non existing callsign is passed:
```
>>> UNRECOVERABLE FATAL ERROR <<<

Call to a member function getCommit() on null

```

Expected Behavior:
Return more graceful error notifying caller that such callsign/repository does not exist

Reproduction steps:
Open conduit: https://secure.phabricator.com/conduit/method/diffusion.getrecentcommitsbypath/
Enter:
callsign: "obviouslynotexisting"
path: "/random"
Click call method

Test Plan: after applying patch - call no longer fails with 500s

Reviewers: Pawka, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19558

+10
+10
src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php
··· 23 23 ); 24 24 } 25 25 26 + protected function defineErrorTypes() { 27 + return array( 28 + 'ERR_NOT_FOUND' => pht('Repository was not found.'), 29 + ); 30 + } 31 + 26 32 protected function defineReturnType() { 27 33 return 'nonempty list<string>'; 28 34 } ··· 35 41 'path' => $request->getValue('path'), 36 42 'branch' => $request->getValue('branch'), 37 43 )); 44 + 45 + if ($drequest === null) { 46 + throw new ConduitException('ERR_NOT_FOUND'); 47 + } 38 48 39 49 $limit = nonempty( 40 50 $request->getValue('limit'),