From 2f4a1a378945ea232d803846f17dc10bca622661 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 21 Jan 2011 15:16:16 +0100 Subject: [PATCH] Catch exceptions from API call. --- turba/lib/Driver/Favourites.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/turba/lib/Driver/Favourites.php b/turba/lib/Driver/Favourites.php index 2468cf109..63e1fe691 100644 --- a/turba/lib/Driver/Favourites.php +++ b/turba/lib/Driver/Favourites.php @@ -131,7 +131,18 @@ class Turba_Driver_Favourites extends Turba_Driver throw new Turba_Exception(_("No source for favourite recipients exists.")); } - $addresses = $registry->call('contacts/favouriteRecipients', array($this->_params['limit'])); + try { + $addresses = $registry->call('contacts/favouriteRecipients', array($this->_params['limit'])); + } catch (Horde_Exception $e) { + if ($e->getCode() == Horde_Registry::AUTH_FAILURE || + $e->getCode() == Horde_Registry::NOT_ACTIVE || + $e->getCode() == Horde_Registry::PERMISSION_DENIED) { + return array(); + } + throw new Turba_Exception($e); + } catch (Exception $e) { + throw new Turba_Exception($e); + } $addressbook = array(); foreach ($addresses as $address) { -- 2.11.0