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

Unhandled Exception: Add last call to error message

Summary:
Phorge does not expose the location of the last call in unhandled exceptions on the web page. One has to open the error log or console to find the location.
The error message in the yellow box comes directly from PHP's `$throwable->getMessage()`, and the stacktrace comes directly from PHP's `$throwable->getTrace()`.
Thus manually concatenate the error message string with `$throwable->getFile()` and `$throwable->getLine()` to display the location of the last call but strip the absolute path not to expose server details.

Closes T15689

Test Plan:
Introduce a random PHP error and load the Phorge page.
For example, add `$chart_view += $chart_panel;` in src/applications/project/controller/PhabricatorProjectReportsController.php and go to http://phorge.localhost/project/reports/1/

Reviewers: O1 Blessed Committers, mainframe98, valerio.bozzolan

Reviewed By: O1 Blessed Committers, mainframe98, valerio.bozzolan

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15689

Differential Revision: https://we.phorge.it/D25955

+9 -1
+9 -1
src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php
··· 42 42 } 43 43 44 44 $class = get_class($throwable); 45 - $message = $throwable->getMessage(); 45 + 46 + if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { 47 + // Include last location in error message 48 + $message = '"'.$throwable->getMessage().'" at '. 49 + PhutilErrorHandler::adjustFilePath($throwable->getFile()). 50 + ':'.$throwable->getLine(); 51 + } else { 52 + $message = $throwable->getMessage(); 53 + } 46 54 47 55 if ($throwable instanceof AphrontSchemaQueryException) { 48 56 $message .= "\n\n".pht(