r70637 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70636‎ | r70637 | r70638 >
Date:18:32, 7 August 2010
Author:ialex
Status:ok
Tags:
Comment:
Added a note to set $wgShowExceptionDetails = true; in LocalSettings.php to get details when encoutring an second exception in the exception handler
Modified paths:
  • /trunk/phase3/includes/Exception.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Exception.php
@@ -283,6 +283,8 @@
284284 * Report an exception to the user
285285 */
286286 function wfReportException( Exception $e ) {
 287+ global $wgShowExceptionDetails;
 288+
287289 $cmdLine = MWException::isCommandLine();
288290 if ( $e instanceof MWException ) {
289291 try {
@@ -292,11 +294,14 @@
293295 // Show a simpler error message for the original exception,
294296 // don't try to invoke report()
295297 $message = "MediaWiki internal error.\n\n";
296 - if ( $GLOBALS['wgShowExceptionDetails'] )
297 - $message .= "Original exception: " . $e->__toString();
298 - $message .= "\n\nException caught inside exception handler";
299 - if ( $GLOBALS['wgShowExceptionDetails'] )
300 - $message .= ": " . $e2->__toString();
 298+ if ( $wgShowExceptionDetails ) {
 299+ $message .= 'Original exception: ' . $e->__toString() . "\n\n" .
 300+ 'Exception caught inside exception handler: ' . $e2->__toString();
 301+ } else {
 302+ $message .= "Exception caught inside exception handler.\n\n" .
 303+ "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " .
 304+ "to show detailed debugging information.";
 305+ }
301306 $message .= "\n";
302307 if ( $cmdLine ) {
303308 wfPrintError( $message );
@@ -307,7 +312,7 @@
308313 } else {
309314 $message = "Unexpected non-MediaWiki exception encountered, of type \"" . get_class( $e ) . "\"\n" .
310315 $e->__toString() . "\n";
311 - if ( $GLOBALS['wgShowExceptionDetails'] ) {
 316+ if ( $wgShowExceptionDetails ) {
312317 $message .= "\n" . $e->getTraceAsString() ."\n";
313318 }
314319 if ( $cmdLine ) {

Status & tagging log