From: Max Semenik Date: Mon, 20 Feb 2012 19:19:52 +0000 (+0000) Subject: Don't output skinned errors in case of unhandled API exceptions X-Git-Tag: 1.31.0-rc.0~24609 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=d3e0e88f1886ed714102587af22daf211eb40415;p=lhc%2Fweb%2Fwiklou.git Don't output skinned errors in case of unhandled API exceptions --- diff --git a/includes/Exception.php b/includes/Exception.php index 3bd89b6e12..e7700b51cf 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -203,7 +203,11 @@ class MWException extends Exception { wfDebugLog( 'exception', $log ); } - if ( self::isCommandLine() ) { + if ( defined( 'MW_API' ) ) { + // Unhandled API exception, we can't be sure that format printer is alive + header( 'MediaWiki-API-Error: internal_api_error_' . get_class( $this ) ); + wfHttpError(500, 'Internal Server Error', $this->getText() ); + } elseif ( self::isCommandLine() ) { MWExceptionHandler::printError( $this->getText() ); } else { $this->reportHTML();