From d3e0e88f1886ed714102587af22daf211eb40415 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Mon, 20 Feb 2012 19:19:52 +0000 Subject: [PATCH] Don't output skinned errors in case of unhandled API exceptions --- includes/Exception.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); -- 2.20.1