From: Jan Schneider Date: Fri, 21 Jan 2011 14:16:16 +0000 (+0100) Subject: Catch exceptions from API call. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2f4a1a378945ea232d803846f17dc10bca622661;p=horde.git Catch exceptions from API call. --- 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) {