From 7e64e98efb08e6c69f0bd29c8edd3cb47574d5da Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 12 Feb 2010 13:04:18 +0100 Subject: [PATCH] Use Horde_Exception_NotFound. --- kronolith/lib/FreeBusy.php | 10 ++++------ kronolith/lib/Kronolith.php | 3 --- kronolith/lib/Storage/kolab.php | 6 ++---- kronolith/lib/Storage/sql.php | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index bfd4db5ff..9fa072089 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -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. */ diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 318d14aa7..be353e9ae 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -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; diff --git a/kronolith/lib/Storage/kolab.php b/kronolith/lib/Storage/kolab.php index 2aea3097e..c819d0757 100644 --- a/kronolith/lib/Storage/kolab.php +++ b/kronolith/lib/Storage/kolab.php @@ -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; diff --git a/kronolith/lib/Storage/sql.php b/kronolith/lib/Storage/sql.php index adef297ad..fd6051c9b 100644 --- a/kronolith/lib/Storage/sql.php +++ b/kronolith/lib/Storage/sql.php @@ -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(); } /** -- 2.11.0