mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
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
This commit is contained in:
parent
4c09e88c95
commit
356b2781bc
1 changed files with 10 additions and 0 deletions
|
@ -23,6 +23,12 @@ final class DiffusionGetRecentCommitsByPathConduitAPIMethod
|
|||
);
|
||||
}
|
||||
|
||||
protected function defineErrorTypes() {
|
||||
return array(
|
||||
'ERR_NOT_FOUND' => pht('Repository was not found.'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function defineReturnType() {
|
||||
return 'nonempty list<string>';
|
||||
}
|
||||
|
@ -36,6 +42,10 @@ final class DiffusionGetRecentCommitsByPathConduitAPIMethod
|
|||
'branch' => $request->getValue('branch'),
|
||||
));
|
||||
|
||||
if ($drequest === null) {
|
||||
throw new ConduitException('ERR_NOT_FOUND');
|
||||
}
|
||||
|
||||
$limit = nonempty(
|
||||
$request->getValue('limit'),
|
||||
self::DEFAULT_LIMIT);
|
||||
|
|
Loading…
Reference in a new issue