Add Turba_Exception.
authorJan Schneider <jan@horde.org>
Wed, 30 Dec 2009 14:09:01 +0000 (15:09 +0100)
committerJan Schneider <jan@horde.org>
Wed, 30 Dec 2009 14:09:01 +0000 (15:09 +0100)
turba/lib/Exception.php [new file with mode: 0644]
turba/lib/Object.php
turba/view.php

diff --git a/turba/lib/Exception.php b/turba/lib/Exception.php
new file mode 100644 (file)
index 0000000..aa54f63
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Base exception class for Turba.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file LICENSE for license information (ASL).  If you
+ * did not receive this file, see http://www.horde.org/licenses/asl.php.
+ *
+ * @author  Jan Schneider <jan@horde.org>
+ * @package Turba
+ */
+class Turba_Exception extends Horde_Exception
+{
+}
index fdc33d3..2b3f344 100644 (file)
@@ -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')) {
index 80e1e4d..f4461ee 100644 (file)
@@ -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 */