[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.20]: MWException: restore prior render() logic

2016-10-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: MWException: restore prior render() logic
..


MWException: restore prior render() logic

Partially revert 00bee02 by restoring the prior MWException::report()
logic. MWExceptionRenderer does not handle all of the MWException
subclasses that somehow modify the default render() behavior. Notable
among these is Flow\Exception\FlowException and its subclasses which
modify the `$wgOut` global to divert HTML output to alternate locations.

Bug: T147122
Depends-On: I2c90e2d9e9b019357458c7e14a3d602b591c6f5b
Change-Id: Ibe3cadca229ce21ed0a3a2482433e3a22b5f5646
(cherry picked from commit eeb382e3c7addd13ee70a58542412628e884f8ec)
---
M includes/exception/MWException.php
1 file changed, 20 insertions(+), 1 deletion(-)

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



diff --git a/includes/exception/MWException.php 
b/includes/exception/MWException.php
index 5496cb6..e958c94 100644
--- a/includes/exception/MWException.php
+++ b/includes/exception/MWException.php
@@ -199,7 +199,26 @@
 * It will be either HTML or plain text based on isCommandLine().
 */
public function report() {
-   MWExceptionRenderer::output( $this, 
MWExceptionRenderer::AS_PRETTY );
+   global $wgMimeType;
+
+   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( $this ) );
+   wfHttpError( 500, 'Internal Server Error', 
$this->getText() );
+   } elseif ( self::isCommandLine() ) {
+   $message = $this->getText();
+   // T17602: STDERR may not be available
+   if ( defined( 'STDERR' ) ) {
+   fwrite( STDERR, $message );
+   } else {
+   echo $message;
+   }
+   } else {
+   self::statusHeader( 500 );
+   self::header( "Content-Type: $wgMimeType; 
charset=utf-8" );
+
+   $this->reportHTML();
+   }
}
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe3cadca229ce21ed0a3a2482433e3a22b5f5646
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.20
Gerrit-Owner: BryanDavis 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.20]: MWException: restore prior render() logic

2016-10-02 Thread BryanDavis (Code Review)
BryanDavis has uploaded a new change for review.

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

Change subject: MWException: restore prior render() logic
..

MWException: restore prior render() logic

Partially revert 00bee02 by restoring the prior MWException::report()
logic. MWExceptionRenderer does not handle all of the MWException
subclasses that somehow modify the default render() behavior. Notable
among these is Flow\Exception\FlowException and its subclasses which
modify the `$wgOut` global to divert HTML output to alternate locations.

Bug: T147122
Change-Id: Ibe3cadca229ce21ed0a3a2482433e3a22b5f5646
(cherry picked from commit eeb382e3c7addd13ee70a58542412628e884f8ec)
---
M includes/exception/MWException.php
1 file changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/313770/1

diff --git a/includes/exception/MWException.php 
b/includes/exception/MWException.php
index 5496cb6..e958c94 100644
--- a/includes/exception/MWException.php
+++ b/includes/exception/MWException.php
@@ -199,7 +199,26 @@
 * It will be either HTML or plain text based on isCommandLine().
 */
public function report() {
-   MWExceptionRenderer::output( $this, 
MWExceptionRenderer::AS_PRETTY );
+   global $wgMimeType;
+
+   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( $this ) );
+   wfHttpError( 500, 'Internal Server Error', 
$this->getText() );
+   } elseif ( self::isCommandLine() ) {
+   $message = $this->getText();
+   // T17602: STDERR may not be available
+   if ( defined( 'STDERR' ) ) {
+   fwrite( STDERR, $message );
+   } else {
+   echo $message;
+   }
+   } else {
+   self::statusHeader( 500 );
+   self::header( "Content-Type: $wgMimeType; 
charset=utf-8" );
+
+   $this->reportHTML();
+   }
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe3cadca229ce21ed0a3a2482433e3a22b5f5646
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.20
Gerrit-Owner: BryanDavis 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits