From: umherirrender Date: Sat, 27 Dec 2014 21:16:29 +0000 (+0100) Subject: Include log id in api error response X-Git-Tag: 1.31.0-rc.0~12848^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=42a95b7a93e814b159907372ee108e4da0da6aa4;p=lhc%2Fweb%2Fwiklou.git Include log id in api error response For internal api error it is helpful for reporting when having the log id under the exception was logged in the exception log. Also use the redacted trace in the api error response instead of the normal one to avoid leakage of function values if exception details are shown. Change-Id: I7d917e532da1b1c7979a6599425f07d2f4f35aed --- diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index a5287b6a10..99f90eea6e 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -710,11 +710,13 @@ class ApiMain extends ApiBase { $errMessage = array( 'code' => 'internal_api_error_' . get_class( $e ), - 'info' => $info, + 'info' => '[' . MWExceptionHandler::getLogId( $e ) . '] ' . $info, ); ApiResult::setContent( $errMessage, - $config->get( 'ShowExceptionDetails' ) ? "\n\n{$e->getTraceAsString()}\n\n" : '' + $config->get( 'ShowExceptionDetails' ) + ? "\n\n" . MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n\n" + : '' ); }