Use Horde_Exception_NotFound.
authorJan Schneider <jan@horde.org>
Fri, 12 Feb 2010 12:04:18 +0000 (13:04 +0100)
committerJan Schneider <jan@horde.org>
Fri, 12 Feb 2010 12:04:18 +0000 (13:04 +0100)
kronolith/lib/FreeBusy.php
kronolith/lib/Kronolith.php
kronolith/lib/Storage/kolab.php
kronolith/lib/Storage/sql.php

index bfd4db5..9fa0720 100644 (file)
@@ -209,13 +209,11 @@ class Kronolith_FreeBusy
         try {
             $fb = $storage->search($email);
             return $json ? self::toJson($fb) : $fb;
-        } catch (Kronolith_Exception $e) {
-            if ($e->getCode() == Kronolith::ERROR_FB_NOT_FOUND) {
-                if ($url) {
-                    throw new Kronolith_Exception(sprintf(_("No free/busy information found at the free/busy url of %s."), $email));
-                }
-                throw new Kronolith_Exception(sprintf(_("No free/busy url found for %s."), $email));
+        } catch (Horde_Exception_NotFound $e) {
+            if ($url) {
+                throw new Kronolith_Exception(sprintf(_("No free/busy information found at the free/busy url of %s."), $email));
             }
+            throw new Kronolith_Exception(sprintf(_("No free/busy url found for %s."), $email));
         }
 
         /* Or else return an empty VFB object. */
index 318d14a..be353e9 100644 (file)
@@ -39,9 +39,6 @@ class Kronolith
     const ITIP_REQUEST = 1;
     const ITIP_CANCEL  = 2;
 
-    /** Free/Busy not found */
-    const ERROR_FB_NOT_FOUND = 1;
-
     /** The event can be delegated. */
     const PERMS_DELEGATE = 1024;
 
index 2aea309..c819d07 100644 (file)
@@ -50,8 +50,7 @@ class Kronolith_Storage_kolab extends Kronolith_Storage
         $http->setBasicAuth(Horde_Auth::getAuth(), Horde_Auth::getCredential('password'));
         @$http->sendRequest();
         if ($http->getResponseCode() != 200) {
-            throw new Kronolith_Exception(sprintf(_("Unable to retrieve free/busy information for %s"),
-                                            $email), Kronolith::ERROR_FB_NOT_FOUND);
+            throw new Horde_Exception_NotFound();
         }
         $vfb_text = $http->getResponseBody();
 
@@ -60,8 +59,7 @@ class Kronolith_Storage_kolab extends Kronolith_Storage
 
         $vfb = &$iCal->findComponent('VFREEBUSY');
         if ($vfb === false) {
-            throw new Kronolith_Exception(sprintf(_("No free/busy information is available for %s"),
-                                    $email), Kronolith::ERROR_FB_NOT_FOUND);
+            throw new Horde_Exception_NotFound();
         }
 
         return $vfb;
index adef297..fd6051c 100644 (file)
@@ -145,7 +145,7 @@ class Kronolith_Storage_sql extends Kronolith_Storage
                 return $vfb;
             }
         }
-        throw new Kronolith_Exception(_("Not found"), Kronolith::ERROR_FB_NOT_FOUND);
+        throw new Horde_Exception_NotFound();
     }
 
     /**