Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/313637

Change subject: Exception rendering fixes
......................................................................

Exception rendering fixes

* Actually use MWExceptionRenderer::AS_RAW. Use this after
  an error is thrown while trying to pretty render the original
  error. This is how this case was originally handled before.
* Do not show the google form or file cache in CLI mode.

Change-Id: I130499753efbf8b4d6d254ea36bacb2473952c1b
---
M includes/exception/MWExceptionHandler.php
M includes/exception/MWExceptionRenderer.php
2 files changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/313637/1

diff --git a/includes/exception/MWExceptionHandler.php 
b/includes/exception/MWExceptionHandler.php
index 797b3af..4a1f190 100644
--- a/includes/exception/MWExceptionHandler.php
+++ b/includes/exception/MWExceptionHandler.php
@@ -68,14 +68,13 @@
                                // removed.
                                $e->report();
                        } else {
-                               MWExceptionRenderer::output(
-                                       $e, MWExceptionRenderer::AS_PRETTY );
+                               MWExceptionRenderer::output( $e, 
MWExceptionRenderer::AS_PRETTY );
                        }
                } catch ( Exception $e2 ) {
                        // Exception occurred from within exception handler
                        // Show a simpler message for the original exception,
                        // don't try to invoke report()
-                       MWExceptionRenderer::output( $e, 
MWExceptionRenderer::AS_PRETTY, $e2 );
+                       MWExceptionRenderer::output( $e, 
MWExceptionRenderer::AS_RAW, $e2 );
                }
        }
 
diff --git a/includes/exception/MWExceptionRenderer.php 
b/includes/exception/MWExceptionRenderer.php
index aba131d..8fdc417 100644
--- a/includes/exception/MWExceptionRenderer.php
+++ b/includes/exception/MWExceptionRenderer.php
@@ -35,11 +35,6 @@
        public static function output( $e, $mode, $eNew = null ) {
                global $wgMimeType;
 
-               if ( $e instanceof DBConnectionError ) {
-                       self::reportOutageHTML( $e );
-                       return;
-               }
-
                if ( defined( 'MW_API' ) ) {
                        // Unhandled API exception, we can't be sure that 
format printer is alive
                        self::header( 'MediaWiki-API-Error: 
internal_api_error_' . get_class( $e ) );
@@ -47,9 +42,13 @@
                } elseif ( self::isCommandLine() ) {
                        self::printError( self::getText( $e ) );
                } elseif ( $mode === self::AS_PRETTY ) {
-                       self::statusHeader( 500 );
-                       self::header( "Content-Type: $wgMimeType; 
charset=utf-8" );
-                       self::reportHTML( $e );
+                       if ( $e instanceof DBConnectionError ) {
+                               self::reportOutageHTML( $e );
+                       } else {
+                               self::statusHeader( 500 );
+                               self::header( "Content-Type: $wgMimeType; 
charset=utf-8" );
+                               self::reportHTML( $e );
+                       }
                } else {
                        if ( $eNew ) {
                                $message = "MediaWiki internal error.\n\n";

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I130499753efbf8b4d6d254ea36bacb2473952c1b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

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

Reply via email to