@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 39 lines 940 B view raw
1<?php 2 3final class PhabricatorAjaxRequestExceptionHandler 4 extends PhabricatorRequestExceptionHandler { 5 6 public function getRequestExceptionHandlerPriority() { 7 return 110000; 8 } 9 10 public function getRequestExceptionHandlerDescription() { 11 return pht('Responds to requests made by AJAX clients.'); 12 } 13 14 public function canHandleRequestThrowable( 15 AphrontRequest $request, 16 $throwable) { 17 // For non-workflow requests, return a Ajax response. 18 return ($request->isAjax() && !$request->isWorkflow()); 19 } 20 21 public function handleRequestThrowable( 22 AphrontRequest $request, 23 $throwable) { 24 25 // Log these; they don't get shown on the client and can be difficult 26 // to debug. 27 phlog($throwable); 28 29 $response = new AphrontAjaxResponse(); 30 $response->setError( 31 array( 32 'code' => get_class($throwable), 33 'info' => $throwable->getMessage(), 34 )); 35 36 return $response; 37 } 38 39}