From: Brad Jorsch Date: Tue, 11 Dec 2012 14:12:08 +0000 (-0500) Subject: (bug 42949) API shouldn't assume all exceptions are MWException X-Git-Tag: 1.31.0-rc.0~21201 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=a97f3550a09c5ee64ebade752c5dfa56a7350d84;p=lhc%2Fweb%2Fwiklou.git (bug 42949) API shouldn't assume all exceptions are MWException Since I20525253, the exception-handling code in ApiMain has inadvertently assumed that all thrown exceptions will be subclasses of MWException. This change restores the check for MWException while preserving the new check for not UsageException introduced in that commit. Change-Id: I5016143a07c871bae910e93b22fefe61a959780c --- diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 85c01f4e18..4afda19414 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -123,6 +123,7 @@ production. log when determining whether an account is used. * (bug 43379) Gracefully fail if rev_len is unavailable for a revision on the History page. +* (bug 42949) API no longer assumes all exceptions are MWException. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat. diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 97f5ecd61e..1e8c84edce 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -375,7 +375,7 @@ class ApiMain extends ApiBase { wfRunHooks( 'ApiMain::onException', array( $this, $e ) ); // Log it - if ( !( $e instanceof UsageException ) ) { + if ( $e instanceof MWException && !( $e instanceof UsageException ) ) { global $wgLogExceptionBacktrace; if ( $wgLogExceptionBacktrace ) { wfDebugLog( 'exception', $e->getLogMessage() . "\n" . $e->getTraceAsString() . "\n" );