exception: Add FIXME about code duplication
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 28 Sep 2018 21:44:36 +0000 (22:44 +0100)
committerKrinkle <krinklemail@gmail.com>
Fri, 28 Sep 2018 22:17:07 +0000 (22:17 +0000)
These methods aren't identical, so consolidation isn't
immediately obvious, and creating dependencies is problematic
in error handling code given there is a lot of pressure on this
code to not by itself cause additional errors.

This means that maybe it's best to keep these inlined without
duplication, but at the very least we then need to remember
to keep these in sync. This duplication has been around for
a while now, but documentation can never come too late...

Change-Id: I60160f61c13c8e115d839acce222f110e30bc2f2

includes/exception/MWException.php
includes/exception/MWExceptionRenderer.php

index ffeafff..af835e4 100644 (file)
@@ -76,6 +76,7 @@ class MWException extends Exception {
                global $wgSitename;
                $args = array_slice( func_get_args(), 2 );
 
+               // FIXME: Keep logic in sync with MWExceptionRenderer::msg.
                $res = false;
                if ( $this->useMessageCache() ) {
                        try {
index 5036383..de2af6b 100644 (file)
@@ -199,6 +199,8 @@ class MWExceptionRenderer {
        private static function msg( $key, $fallback /*[, params...] */ ) {
                global $wgSitename;
                $args = array_slice( func_get_args(), 2 );
+
+               // FIXME: Keep logic in sync with MWException::msg.
                try {
                        $res = wfMessage( $key, $args )->text();
                } catch ( Exception $e ) {