Ori.livneh has uploaded a new change for review.

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

Change subject: MWException -> Exception
......................................................................

MWException -> Exception

Change-Id: I6729c34621e8a8c4523db0da412682cab4d3d6a5
---
M Scribunto.magic.php
M common/Common.php
M common/Hooks.php
M engines/LuaCommon/LanguageLibrary.php
M engines/LuaCommon/LuaCommon.php
M engines/LuaCommon/LuaInterpreter.php
M engines/LuaCommon/MessageLibrary.php
M engines/LuaSandbox/Engine.php
M engines/LuaStandalone/LuaStandaloneEngine.php
M tests/engines/LuaCommon/CommonTest.php
10 files changed, 28 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/99/184099/1

diff --git a/Scribunto.magic.php b/Scribunto.magic.php
index 848e6cc..4ecc12e 100644
--- a/Scribunto.magic.php
+++ b/Scribunto.magic.php
@@ -118,4 +118,4 @@
 /** Simplified Chinese (中文(简体)‎) */
 $magicWords['zh-hans'] = array(
        'invoke' => array( 0, '调用' ),
-);
\ No newline at end of file
+);
diff --git a/common/Common.php b/common/Common.php
index df48a73..1321b56 100644
--- a/common/Common.php
+++ b/common/Common.php
@@ -21,17 +21,17 @@
         * Create a new engine object with default parameters
         *
         * @param $extraOptions array Extra options to pass to the constructor, 
in addition to the configured options
-        * @throws MWException
+        * @throws Exception
         * @return ScribuntoEngineBase
         */
        public static function newDefaultEngine( $extraOptions = array() ) {
                global $wgScribuntoDefaultEngine, $wgScribuntoEngineConf;
                if( !$wgScribuntoDefaultEngine ) {
-                       throw new MWException( 'Scribunto extension is enabled 
but $wgScribuntoDefaultEngine is not set' );
+                       throw new Exception( 'Scribunto extension is enabled 
but $wgScribuntoDefaultEngine is not set' );
                }
 
                if( !isset( $wgScribuntoEngineConf[$wgScribuntoDefaultEngine] ) 
) {
-                       throw new MWException( 'Invalid scripting engine is 
specified in $wgScribuntoDefaultEngine' );
+                       throw new Exception( 'Invalid scripting engine is 
specified in $wgScribuntoDefaultEngine' );
                }
                $options = $extraOptions + 
$wgScribuntoEngineConf[$wgScribuntoDefaultEngine];
                return self::newEngine( $options );
@@ -124,7 +124,7 @@
  * An exception class which represents an error in the script. This does not
  * normally abort the request, instead it is caught and shown to the user.
  */
-class ScribuntoException extends MWException {
+class ScribuntoException extends Exception {
        /**
         * @var string
         */
diff --git a/common/Hooks.php b/common/Hooks.php
index b34a0ee..1077bc1 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -76,13 +76,13 @@
         * @param Parser $parser
         * @param PPFrame $frame
         * @param array $args
-        * @throws MWException
+        * @throws Exception
         * @throws ScribuntoException
         * @return string
         */
        public static function invokeHook( Parser &$parser, PPFrame $frame, 
array $args ) {
                if ( !@constant( get_class( $frame ) . 
'::SUPPORTS_INDEX_OFFSET' ) ) {
-                       throw new MWException(
+                       throw new Exception(
                                'Scribunto needs MediaWiki 1.20 or later 
(Preprocessor::SUPPORTS_INDEX_OFFSET)' );
                }
 
diff --git a/engines/LuaCommon/LanguageLibrary.php 
b/engines/LuaCommon/LanguageLibrary.php
index 31e49ae..bec7d3d 100644
--- a/engines/LuaCommon/LanguageLibrary.php
+++ b/engines/LuaCommon/LanguageLibrary.php
@@ -61,7 +61,7 @@
                try {
                        // There's no good reason this should throw, but it 
does. Sigh.
                        return array( Language::isSupportedLanguage( $code ) );
-               } catch ( MWException $ex ) {
+               } catch ( Exception $ex ) {
                        return array( false );
                }
        }
@@ -115,7 +115,7 @@
                        }
                        try {
                                $this->langCache[$code] = Language::factory( 
$code );
-                       } catch ( MWException $ex ) {
+                       } catch ( Exception $ex ) {
                                throw new Scribunto_LuaError( "language code 
'$code' is invalid" );
                        }
                }
diff --git a/engines/LuaCommon/LuaCommon.php b/engines/LuaCommon/LuaCommon.php
index f8a6e2e..d393ed2 100644
--- a/engines/LuaCommon/LuaCommon.php
+++ b/engines/LuaCommon/LuaCommon.php
@@ -305,7 +305,7 @@
        protected function loadLibraryFromFile( $fileName ) {
                $code = file_get_contents( $fileName );
                if ( $code === false ) {
-                       throw new MWException( 'Lua file does not exist: ' . 
$fileName );
+                       throw new Exception( 'Lua file does not exist: ' . 
$fileName );
                }
                # Prepending an "@" to the chunk name makes Lua think it is a 
filename
                $module = $this->getInterpreter()->loadString( $code, '@' . 
basename( $fileName ) );
@@ -429,7 +429,7 @@
         * @param string $name
         * @param array|string $def
         * @param bool $loadDeferred
-        * @throws MWException
+        * @throws Exception
         * @return array|null
         */
        private function instantiatePHPLibrary( $name, $def, $loadDeferred ) {
@@ -443,7 +443,7 @@
                        if ( isset( $def['class'] ) ) {
                                $class = new $def['class']( $this );
                        } else {
-                               throw new MWException( "No class for library 
\"$name\"" );
+                               throw new Exception( "No class for library 
\"$name\"" );
                        }
                }
                $this->loadedLibraries[$name] = $class;
@@ -659,7 +659,7 @@
         * @param $frameId
         * @param $function
         * @param $args
-        * @throws MWException
+        * @throws Exception
         * @throws Scribunto_LuaError
         * @return array
         */
diff --git a/engines/LuaCommon/LuaInterpreter.php 
b/engines/LuaCommon/LuaInterpreter.php
index c9e0eff..3c344a7 100644
--- a/engines/LuaCommon/LuaInterpreter.php
+++ b/engines/LuaCommon/LuaInterpreter.php
@@ -59,4 +59,4 @@
        abstract public function unpauseUsageTimer();
 }
 
-class Scribunto_LuaInterpreterNotFoundError extends MWException {}
+class Scribunto_LuaInterpreterNotFoundError extends Exception {}
diff --git a/engines/LuaCommon/MessageLibrary.php 
b/engines/LuaCommon/MessageLibrary.php
index 0ef9338..89811d9 100644
--- a/engines/LuaCommon/MessageLibrary.php
+++ b/engines/LuaCommon/MessageLibrary.php
@@ -38,7 +38,7 @@
                try {
                        $msg = $this->makeMessage( $data, true );
                        return array( $msg->plain() );
-               } catch( MWException $ex ) {
+               } catch( Exception $ex ) {
                        throw new Scribunto_LuaError( "msg:plain() failed (" . 
$ex->getMessage() . ")" );
                }
        }
@@ -51,7 +51,7 @@
                try {
                        $msg = $this->makeMessage( $data, false );
                        return array( call_user_func( array( $msg, $what ) ) );
-               } catch( MWException $ex ) {
+               } catch( Exception $ex ) {
                        throw new Scribunto_LuaError( "msg:$what() failed (" . 
$ex->getMessage() . ")" );
                }
        }
diff --git a/engines/LuaSandbox/Engine.php b/engines/LuaSandbox/Engine.php
index f4107f5..637d90d 100644
--- a/engines/LuaSandbox/Engine.php
+++ b/engines/LuaSandbox/Engine.php
@@ -299,7 +299,7 @@
                                // Per the documentation on 
LuaSandboxFunction::call, a return value
                                // of false means that something went wrong and 
it's PHP's fault,
                                // so throw a "real" exception.
-                               throw new MWException(
+                               throw new Exception(
                                        __METHOD__ . ': 
LuaSandboxFunction::call returned false' );
                        }
                        return $ret;
diff --git a/engines/LuaStandalone/LuaStandaloneEngine.php 
b/engines/LuaStandalone/LuaStandaloneEngine.php
index 048b148..e5d7a0a 100644
--- a/engines/LuaStandalone/LuaStandaloneEngine.php
+++ b/engines/LuaStandalone/LuaStandaloneEngine.php
@@ -167,7 +167,7 @@
        /**
         * @param Scribunto_LuaStandaloneEngine $engine
         * @param array $options
-        * @throws MWException
+        * @throws Exception
         * @throws Scribunto_LuaInterpreterNotFoundError
         * @throws ScribuntoException
         */
@@ -205,7 +205,7 @@
                        $options['luaPath'] = dirname( __FILE__ ) . 
"/binaries/$path";
 
                        if( !is_executable( $options['luaPath'] ) ) {
-                               throw new MWException( sprintf( 'The lua binary 
(%s) is not executable.', $options['luaPath'] ) );
+                               throw new Exception( sprintf( 'The lua binary 
(%s) is not executable.', $options['luaPath'] ) );
                        }
                }
 
@@ -344,10 +344,10 @@
 
        public function callFunction( $func /* ... */ ) {
                if ( !($func instanceof 
Scribunto_LuaStandaloneInterpreterFunction) ) {
-                       throw new MWException( __METHOD__.': invalid function 
type' );
+                       throw new Exception( __METHOD__.': invalid function 
type' );
                }
                if ( $func->interpreterId !== $this->id ) {
-                       throw new MWException( __METHOD__.': function belongs 
to a different interpreter' );
+                       throw new Exception( __METHOD__.': function belongs to 
a different interpreter' );
                }
                $args = func_get_args();
                unset( $args[0] );
@@ -546,7 +546,7 @@
 
        protected function encodeLuaVar( $var, $level = 0 ) {
                if ( $level > 100 ) {
-                       throw new MWException( __METHOD__.': recursion depth 
limit exceeded' );
+                       throw new Exception( __METHOD__.': recursion depth 
limit exceeded' );
                }
                $type = gettype( $var );
                switch ( $type ) {
@@ -565,7 +565,7 @@
                                        if ( $var === -INF ) {
                                                return '(-1/0)';
                                        }
-                                       throw new MWException( __METHOD__.': 
cannot convert non-finite number' );
+                                       throw new Exception( __METHOD__.': 
cannot convert non-finite number' );
                                }
                                return $var;
                        case 'string':
@@ -591,19 +591,19 @@
                                return $s;
                        case 'object':
                                if ( !( $var instanceof 
Scribunto_LuaStandaloneInterpreterFunction ) ) {
-                                       throw new MWException( __METHOD__.': 
unable to convert object of type ' .
+                                       throw new Exception( __METHOD__.': 
unable to convert object of type ' .
                                                get_class( $var ) );
                                } elseif ( $var->interpreterId !== $this->id ) {
-                                       throw new MWException( __METHOD__.': 
unable to convert function belonging to a different interpreter' );
+                                       throw new Exception( __METHOD__.': 
unable to convert function belonging to a different interpreter' );
                                } else {
                                        return 'chunks[' . intval( $var->id )  
. ']';
                                }
                        case 'resource':
-                               throw new MWException( __METHOD__.': unable to 
convert resource' );
+                               throw new Exception( __METHOD__.': unable to 
convert resource' );
                        case 'NULL':
                                return 'nil';
                        default:
-                               throw new MWException( __METHOD__.': unable to 
convert variable of unknown type' );
+                               throw new Exception( __METHOD__.': unable to 
convert variable of unknown type' );
                }
        }
 
diff --git a/tests/engines/LuaCommon/CommonTest.php 
b/tests/engines/LuaCommon/CommonTest.php
index 03144c1..6158f6b 100644
--- a/tests/engines/LuaCommon/CommonTest.php
+++ b/tests/engines/LuaCommon/CommonTest.php
@@ -736,7 +736,7 @@
 
 class Scribunto_LuaCommonTestsFailLibrary extends Scribunto_LuaLibraryBase {
        public function __construct() {
-               throw new MWException( 'deferLoad library that is never 
required was loaded anyway' );
+               throw new Exception( 'deferLoad library that is never required 
was loaded anyway' );
        }
 
        public function register() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6729c34621e8a8c4523db0da412682cab4d3d6a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to