From: Brad Jorsch Date: Fri, 1 Nov 2013 18:46:19 +0000 (-0400) Subject: MWException: Cleanup exception message output X-Git-Tag: 1.31.0-rc.0~18315^2 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=451599d812d4421902cbae16990a4ddf3417d205;p=lhc%2Fweb%2Fwiklou.git MWException: Cleanup exception message output Change I0a9e9244 lost the message when handling a non-MWException exception, and for a long time MWException's getHTML and getText have been missing the actual file and line where the exception was thrown. We may as well use MWExceptionHandler::getLogMessage to fix all of these, resulting in a more standardized exception output. Change-Id: I8a9b4831c9c586bafe0a54516ff779cdfb008984 --- diff --git a/includes/Exception.php b/includes/Exception.php index 9623a8444a..ac98564e2c 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -140,7 +140,7 @@ class MWException extends Exception { global $wgShowExceptionDetails; if ( $wgShowExceptionDetails ) { - return '

' . nl2br( htmlspecialchars( $this->getMessage() ) ) . + return '

' . nl2br( htmlspecialchars( MWExceptionHandler::getLogMessage( $this ) ) ) . '

Backtrace:

' . nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) . "

\n"; } else { @@ -165,7 +165,7 @@ class MWException extends Exception { global $wgShowExceptionDetails; if ( $wgShowExceptionDetails ) { - return $this->getMessage() . + return MWExceptionHandler::getLogMessage( $this ) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString( $this ) . "\n"; } else { return "Set \$wgShowExceptionDetails = true; " . @@ -641,8 +641,7 @@ class MWExceptionHandler { get_class( $e ) . "\""; if ( $wgShowExceptionDetails ) { - $message .= "\nexception '" . get_class( $e ) . "' in " . - $e->getFile() . ":" . $e->getLine() . "\nStack trace:\n" . + $message .= "\n" . MWExceptionHandler::getLogMessage( $e ) . "\nBacktrace:\n" . self::getRedactedTraceAsString( $e ) . "\n"; }