From 29863cb7f2ffb4d3c112e476ceb57624c1e473c2 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 30 Dec 2009 15:09:01 +0100 Subject: [PATCH] Add Turba_Exception. --- turba/lib/Exception.php | 15 +++++++++++++++ turba/lib/Object.php | 4 ++-- turba/view.php | 14 +++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 turba/lib/Exception.php diff --git a/turba/lib/Exception.php b/turba/lib/Exception.php new file mode 100644 index 000000000..aa54f63ec --- /dev/null +++ b/turba/lib/Exception.php @@ -0,0 +1,15 @@ + + * @package Turba + */ +class Turba_Exception extends Horde_Exception +{ +} diff --git a/turba/lib/Object.php b/turba/lib/Object.php index fdc33d305..2b3f34422 100644 --- a/turba/lib/Object.php +++ b/turba/lib/Object.php @@ -384,14 +384,14 @@ class Turba_Object { /** * Loads the VFS configuration and initializes the VFS backend. * - * @throws Horde_Exception + * @throws Turba_Exception */ function _vfsInit() { if (!isset($this->_vfs)) { $v_params = Horde::getVFSConfig('documents'); if (is_a($v_params, 'PEAR_Error')) { - throw new Horde_Exception($v_params); + throw new Turba_Exception($v_params); } $result = VFS::singleton($v_params['type'], $v_params['params']); if (is_a($result, 'PEAR_Error')) { diff --git a/turba/view.php b/turba/view.php index 80e1e4d98..f4461ee8f 100644 --- a/turba/view.php +++ b/turba/view.php @@ -13,7 +13,7 @@ require_once dirname(__FILE__) . '/lib/base.php'; if ($conf['documents']['type'] == 'none') { - throw new Horde_Exception(_("The VFS backend needs to be configured to enable attachment uploads.")); + throw new Turba_Exception(_("The VFS backend needs to be configured to enable attachment uploads.")); } $source = Horde_Util::getFormData('source'); @@ -24,32 +24,32 @@ $type = Horde_Util::getFormData('type'); /* Get the object. */ if (!isset($cfgSources[$source])) { - throw new Horde_Exception(_("The contact you requested does not exist.")); + throw new Turba_Exception(_("The contact you requested does not exist.")); } $driver = Turba_Driver::singleton($source); $object = $driver->getObject($key); if (is_a($object, 'PEAR_Error')) { - throw new Horde_Exception($object); + throw new Turba_Exception($object); } /* Check permissions. */ if (!$object->hasPermission(Horde_Perms::READ)) { - throw new Horde_Exception(_("You do not have permission to view this contact.")); + throw new Turba_Exception(_("You do not have permission to view this contact.")); } $v_params = Horde::getVFSConfig('documents'); if (is_a($v_params, 'PEAR_Error')) { - throw new Horde_Exception($v_params); + throw new Turba_Exception($v_params); } $vfs = VFS::singleton($v_params['type'], $v_params['params']); if (is_a($vfs, 'PEAR_Error')) { - throw new Horde_Exception($vfs); + throw new Turba_Exception($vfs); } else { $data = $vfs->read(TURBA_VFS_PATH . '/' . $object->getValue('__uid'), $filename); } if (is_a($data, 'PEAR_Error')) { Horde::logMessage($data, __FILE__, __LINE__, PEAR_LOG_ERR); - throw new Horde_Exception(sprintf(_("Access denied to %s"), $filename)); + throw new Turba_Exception(sprintf(_("Access denied to %s"), $filename)); } /* Run through action handlers */ -- 2.11.0