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

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

+19 -1
+19 -1
src/applications/diffusion/controller/DiffusionServeController.php
··· 397 397 switch ($vcs_type) { 398 398 case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 399 399 case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 400 - $result = $this->serveVCSRequest($repository, $viewer); 400 + $caught = null; 401 + try { 402 + $result = $this->serveVCSRequest($repository, $viewer); 403 + } catch (Exception $ex) { 404 + $caught = $ex; 405 + } catch (Throwable $ex) { 406 + $caught = $ex; 407 + } 408 + 409 + if ($caught) { 410 + // We never expect an uncaught exception here, so dump it to the 411 + // log. All routine errors should have been converted into Response 412 + // objects by a lower layer. 413 + phlog($caught); 414 + 415 + $result = new PhabricatorVCSResponse( 416 + 500, 417 + phutil_string_cast($caught->getMessage())); 418 + } 401 419 break; 402 420 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 403 421 $result = new PhabricatorVCSResponse(