Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -314,14 +314,21 @@ |
315 | 315 | ApiResult :: setContent($errMessage, $this->makeHelpMsg()); |
316 | 316 | |
317 | 317 | } else { |
| 318 | + global $wgShowSQLErrors, $wgShowExceptionDetails; |
318 | 319 | // |
319 | 320 | // Something is seriously wrong |
320 | 321 | // |
| 322 | + if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) { |
| 323 | + $info = "Database query error"; |
| 324 | + } else { |
| 325 | + $info = "Exception Caught: {$e->getMessage()}"; |
| 326 | + } |
| 327 | + |
321 | 328 | $errMessage = array ( |
322 | 329 | 'code' => 'internal_api_error_'. get_class($e), |
323 | | - 'info' => "Exception Caught: {$e->getMessage()}" |
| 330 | + 'info' => $info, |
324 | 331 | ); |
325 | | - ApiResult :: setContent($errMessage, "\n\n{$e->getTraceAsString()}\n\n"); |
| 332 | + ApiResult :: setContent($errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : "" ); |
326 | 333 | } |
327 | 334 | |
328 | 335 | $this->getResult()->reset(); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -477,6 +477,7 @@ |
478 | 478 | * Added bkip parameter to list=blocks |
479 | 479 | * (bug 14651) apprefix and similar parameters are now canonicalized |
480 | 480 | * Added clprop=timestamp to prop=categories |
| 481 | +* (bug 14678) API errors now respects $wgShowExceptionDetails and $wgShowSQLErrors |
481 | 482 | |
482 | 483 | === Languages updated in 1.13 === |
483 | 484 | |