jenkins-bot has submitted this change and it was merged.

Change subject: MWException: Cleanup exception message output
......................................................................


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
---
M includes/Exception.php
1 file changed, 3 insertions(+), 4 deletions(-)

Approvals:
  MarkAHershberger: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Exception.php b/includes/Exception.php
index 6f511b7..5bad88c 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -135,7 +135,7 @@
                global $wgShowExceptionDetails;
 
                if ( $wgShowExceptionDetails ) {
-                       return '<p>' . nl2br( htmlspecialchars( 
$this->getMessage() ) ) .
+                       return '<p>' . nl2br( htmlspecialchars( 
MWExceptionHandler::getLogMessage( $this ) ) ) .
                                '</p><p>Backtrace:</p><p>' . nl2br( 
htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
                                "</p>\n";
                } else {
@@ -160,7 +160,7 @@
                global $wgShowExceptionDetails;
 
                if ( $wgShowExceptionDetails ) {
-                       return $this->getMessage() .
+                       return MWExceptionHandler::getLogMessage( $this ) .
                                "\nBacktrace:\n" . 
MWExceptionHandler::getRedactedTraceAsString( $this ) . "\n";
                } else {
                        return "Set \$wgShowExceptionDetails = true; " .
@@ -633,8 +633,7 @@
                        $message = "Unexpected non-MediaWiki exception 
encountered, of type \"" . 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";
                        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/93704
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a9b4831c9c586bafe0a54516ff779cdfb008984
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_22
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to