mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Catch more HTTP VCS errors and convert them into VCS repsonses
Summary: Ref T13590. Currently, errors arising from cluster locking (like the "stuck write lock" exception) are not caught and converted into VCS responses on the HTTP VCS workflow. Catch a broader range of exceptions and convert them into appropriate responses. Test Plan: - Forced a "stuck write lock" exception, pushed to a Git repository over HTTP. - Before: generic fatal. - After: VCS-specific fatal with a useful message in the "X-Phabricator-Message" response header. Maniphest Tasks: T13590 Differential Revision: https://secure.phabricator.com/D21525
This commit is contained in:
parent
32c82a53de
commit
da7d92dd0a
1 changed files with 19 additions and 1 deletions
|
@ -397,7 +397,25 @@ final class DiffusionServeController extends DiffusionController {
|
|||
switch ($vcs_type) {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||
$caught = null;
|
||||
try {
|
||||
$result = $this->serveVCSRequest($repository, $viewer);
|
||||
} catch (Exception $ex) {
|
||||
$caught = $ex;
|
||||
} catch (Throwable $ex) {
|
||||
$caught = $ex;
|
||||
}
|
||||
|
||||
if ($caught) {
|
||||
// We never expect an uncaught exception here, so dump it to the
|
||||
// log. All routine errors should have been converted into Response
|
||||
// objects by a lower layer.
|
||||
phlog($caught);
|
||||
|
||||
$result = new PhabricatorVCSResponse(
|
||||
500,
|
||||
phutil_string_cast($caught->getMessage()));
|
||||
}
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
$result = new PhabricatorVCSResponse(
|
||||
|
|
Loading…
Reference in a new issue