API: Clean up uncaught exception backtrace output
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 29 Dec 2014 18:57:40 +0000 (13:57 -0500)
committerUmherirrender <umherirrender_de.wp@web.de>
Mon, 29 Dec 2014 19:09:54 +0000 (19:09 +0000)
The existing response seems to be designed to look good with
format=xmlfm, which doesn't make much sense now that format=jsonfm is
the default.

Change-Id: Ic3993aaf7e401d6233bbbe4522e77004099e3c40

includes/api/ApiMain.php

index 99f90ee..1544189 100644 (file)
@@ -712,12 +712,12 @@ class ApiMain extends ApiBase {
                                'code' => 'internal_api_error_' . get_class( $e ),
                                'info' => '[' . MWExceptionHandler::getLogId( $e ) . '] ' . $info,
                        );
-                       ApiResult::setContent(
-                               $errMessage,
-                               $config->get( 'ShowExceptionDetails' )
-                                       ? "\n\n" . MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n\n"
-                                       : ''
-                       );
+                       if ( $config->get( 'ShowExceptionDetails' ) ) {
+                               ApiResult::setContent(
+                                       $errMessage,
+                                       MWExceptionHandler::getRedactedTraceAsString( $e )
+                               );
+                       }
                }
 
                // Remember all the warnings to re-add them later