Index: includes/api/ApiMain.php =================================================================== --- includes/api/ApiMain.php (revision 36771) +++ includes/api/ApiMain.php (working copy) @@ -288,6 +288,7 @@ * Returns the error code */ protected function substituteResultWithError($e) { + global $wgShowSQLErrors, $wgShowExceptionDetails; // Printer may not be initialized if the extractRequestParams() fails for the main module if (!isset ($this->mPrinter)) { @@ -317,11 +318,18 @@ // // Something is seriously wrong // + if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) { + $info = "Database query error"; + } else { + $info = "Exception Caught: {$e->getMessage()}"; + } + $errMessage = array ( 'code' => 'internal_api_error_'. get_class($e), - 'info' => "Exception Caught: {$e->getMessage()}" + 'info' => $info ); - ApiResult :: setContent($errMessage, "\n\n{$e->getTraceAsString()}\n\n"); + + ApiResult :: setContent($errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : "" ); } $this->getResult()->reset();