@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
at upstream/main 33 lines 806 B view raw
1<?php 2 3final class PhabricatorConduitRequestExceptionHandler 4 extends PhabricatorRequestExceptionHandler { 5 6 public function getRequestExceptionHandlerPriority() { 7 return 100000; 8 } 9 10 public function getRequestExceptionHandlerDescription() { 11 return pht('Responds to requests made by Conduit clients.'); 12 } 13 14 public function canHandleRequestThrowable( 15 AphrontRequest $request, 16 $throwable) { 17 return $request->isConduit(); 18 } 19 20 public function handleRequestThrowable( 21 AphrontRequest $request, 22 $throwable) { 23 24 $response = id(new ConduitAPIResponse()) 25 ->setErrorCode(get_class($throwable)) 26 ->setErrorInfo($throwable->getMessage()); 27 28 return id(new AphrontJSONResponse()) 29 ->setAddJSONShield(false) 30 ->setContent($response->toDictionary()); 31 } 32 33}