use InvalidArgumentException rather then Exception
authorjeroendedauw <jeroendedauw@gmail.com>
Mon, 27 Aug 2012 11:34:02 +0000 (13:34 +0200)
committerjeroendedauw <jeroendedauw@gmail.com>
Mon, 27 Aug 2012 11:34:02 +0000 (13:34 +0200)
Change-Id: Ie744c773b316278e4a92af28354a8fe4eb83b78f

includes/libs/GenericArrayObject.php
tests/phpunit/includes/libs/GenericArrayObjectTest.php

index d4cc525..b4b9d61 100644 (file)
@@ -142,11 +142,11 @@ abstract class GenericArrayObject extends ArrayObject {
         * @param mixed $index
         * @param mixed $value
         *
-        * @throws Exception
+        * @throws InvalidArgumentException
         */
        protected function setElement( $index, $value ) {
                if ( !$this->hasValidType( $value ) ) {
-                       throw new Exception(
+                       throw new InvalidArgumentException(
                                'Can only add ' . $this->getObjectType() . ' implementing objects to ' . get_called_class() . '.'
                        );
                }
index bf3ff3c..8a2fb55 100644 (file)
@@ -170,7 +170,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
                                call_user_func( $function, $list, $element );
                                $valid = true;
                        }
-                       catch ( Exception $exception ) {
+                       catch ( InvalidArgumentException $exception ) {
                                $valid = false;
                        }