Kaldari has uploaded a new change for review.

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

Change subject: Replacing generic Exception with Exception subclasses
......................................................................

Replacing generic Exception with Exception subclasses

Improves ability to debug.

Change-Id: I21a51fc5b4f185a01ba4706bd5a853c2974057dd
---
M includes/TemplateParser.php
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/196442/1

diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php
index 0dbf2c7..a22f280 100644
--- a/includes/TemplateParser.php
+++ b/includes/TemplateParser.php
@@ -49,7 +49,7 @@
         * Constructs the location of the the source Mustache template
         * @param string $templateName The name of the template
         * @return string
-        * @throws Exception Disallows upwards directory traversal via 
$templateName
+        * @throws UnexpectedValueException Disallows upwards directory 
traversal via $templateName
         */
        public function getTemplateFilename( $templateName ) {
                // Prevent upwards directory traversal using same methods as 
Title::secureAndSplit
@@ -65,7 +65,7 @@
                                substr( $templateName, -3 ) === '/..'
                        )
                ) {
-                       throw new Exception( "Malformed \$templateName: 
$templateName" );
+                       throw new UnexpectedValueException( "Malformed 
\$templateName: $templateName" );
                }
 
                return "{$this->templateDir}/{$templateName}.mustache";
@@ -75,7 +75,7 @@
         * Returns a given template function if found, otherwise throws an 
exception.
         * @param string $templateName The name of the template (without file 
suffix)
         * @return Function
-        * @throws Exception
+        * @throws RuntimeException
         */
        public function getTemplate( $templateName ) {
                // If a renderer has already been defined for this template, 
reuse it
@@ -86,7 +86,7 @@
                $filename = $this->getTemplateFilename( $templateName );
 
                if ( !file_exists( $filename ) ) {
-                       throw new Exception( "Could not locate template: 
{$filename}" );
+                       throw new RuntimeException( "Could not locate template: 
{$filename}" );
                }
 
                // Read the template file
@@ -143,14 +143,14 @@
         * @param string $fileContents Mustache code
         * @param string $filename Name of the template
         * @return string PHP code (without '<?php')
-        * @throws Exception
+        * @throws RuntimeException
         */
        public function compileForEval( $fileContents, $filename ) {
                // Compile the template into PHP code
                $code = self::compile( $fileContents );
 
                if ( !$code ) {
-                       throw new Exception( "Could not compile template: 
{$filename}" );
+                       throw new RuntimeException( "Could not compile 
template: {$filename}" );
                }
 
                // Strip the "<?php" added by lightncandy so that it can be 
eval()ed
@@ -165,11 +165,11 @@
         * Compile the Mustache code into PHP code using LightnCandy
         * @param string $code Mustache code
         * @return string PHP code (with '<?php')
-        * @throws Exception
+        * @throws RuntimeException
         */
        public static function compile( $code ) {
                if ( !class_exists( 'LightnCandy' ) ) {
-                       throw new Exception( 'LightnCandy class not defined' );
+                       throw new RuntimeException( 'LightnCandy class not 
defined' );
                }
                return LightnCandy::compile(
                        $code,

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

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

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

Reply via email to