Remove unnecessary try/catch
authorymh <ymh.work@gmail.com>
Fri, 09 Dec 2011 02:27:20 +0100
changeset 60 984ba20c150b
parent 59 ea562f37d7a5
child 61 1bc0ec8ed05b
Remove unnecessary try/catch
Controller/WikiTagController.php
Entity/TagRepository.php
Utils/WikiTagUtils.php
--- a/Controller/WikiTagController.php	Fri Dec 09 02:21:17 2011 +0100
+++ b/Controller/WikiTagController.php	Fri Dec 09 02:27:20 2011 +0100
@@ -598,12 +598,7 @@
             if($label!=$tag->getLabel()){
                 // We get the Wikipedia informations for the sent label
                 $tag_label_normalized = WikiTagUtils::normalizeTag($label);
-                try {
-                    $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
-                }
-                catch (\Exception $e){
-                    throw new \Exception($e->getMessage());
-                }
+                $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
                 $tag->setWikipediaInfo($wp_response);
                 // Save datas.
                 $em = $this->getDoctrine()->getEntityManager();
--- a/Entity/TagRepository.php	Fri Dec 09 02:21:17 2011 +0100
+++ b/Entity/TagRepository.php	Fri Dec 09 02:27:20 2011 +0100
@@ -83,12 +83,7 @@
         if($created==true || $tag->getUrlStatus()===Tag::$TAG_URL_STATUS_DICT['null_result']) {
             
             if($wp_request_done==false) {
-                try {
-                    $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
-                }
-                catch (\Exception $e){
-                    throw new \Exception($e->getMessage());
-                }
+                $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
             }
             
             $tag->setWikipediaInfo($wp_response);
@@ -101,13 +96,8 @@
             $wikipedia_revision_id = $wp_response['revision_id'];
     
         }
-        else if($tag!=null && $tag->getWikipediaPageId()!=null) {
-            try {
-                $wp_response = WikiTagUtils::getWikipediaInfo(null, $tag->getWikipediaPageId());
-            }
-            catch (\Exception $e){
-                throw new \Exception($e->getMessage());
-            }
+        elseif($tag!=null && $tag->getWikipediaPageId()!=null) {
+            $wp_response = WikiTagUtils::getWikipediaInfo(null, $tag->getWikipediaPageId());
             $wikipedia_revision_id = $wp_response['revision_id'];
         }
         else {
--- a/Utils/WikiTagUtils.php	Fri Dec 09 02:21:17 2011 +0100
+++ b/Utils/WikiTagUtils.php	Fri Dec 09 02:27:20 2011 +0100
@@ -60,12 +60,8 @@
             return WikiTagUtils::returnNullResult(null);
         }
         
-        try {
-            $ar = WikiTagUtils::requestWikipedia($params);
-        }
-        catch (\Exception $e){
-            throw new \Exception($e->getMessage());
-        }
+        $ar = WikiTagUtils::requestWikipedia($params);
+
         $res = $ar[0];
         $original_response = $res;
         $pages = $ar[1];