a redirect and its target.
* (bug 43849) ApiQueryImageInfo no longer throws exceptions with ForeignDBRepo
redirects.
+* On error, any warnings generated before that error will be shown in the result.
=== API internal changes in 1.21 ===
* For debugging only, a new global $wgDebugAPI removes many API restrictions when true.
}
}
- // Handle any kind of exception by outputing properly formatted error message.
+ // Handle any kind of exception by outputting properly formatted error message.
// If this fails, an unhandled exception should be thrown so that global error
// handler will process and log it.
if ( $this->mPrinter->getWantsHelp() || $this->mAction == 'help' ) {
ApiResult::setContent( $errMessage, $this->makeHelpMsg() );
}
-
} else {
global $wgShowSQLErrors, $wgShowExceptionDetails;
// Something is seriously wrong
ApiResult::setContent( $errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : '' );
}
+ // Remember all the warnings to re-add them later
+ $oldResult = $result->getData();
+ $warnings = isset( $oldResult['warnings'] ) ? $oldResult['warnings'] : null;
+
$result->reset();
$result->disableSizeCheck();
// Re-add the id
if ( !is_null( $requestid ) ) {
$result->addValue( null, 'requestid', $requestid );
}
-
if ( $wgShowHostnames ) {
// servedby is especially useful when debugging errors
$result->addValue( null, 'servedby', wfHostName() );
}
+ if ( $warnings !== null ) {
+ $result->addValue( null, 'warnings', $warnings );
+ }
$result->addValue( null, 'error', $errMessage );