Use IMP_Exception in more locations
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 24 Apr 2010 17:29:39 +0000 (11:29 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 26 Apr 2010 04:51:15 +0000 (22:51 -0600)
21 files changed:
imp/lib/Ajax/Application.php
imp/lib/Api.php
imp/lib/Compose.php
imp/lib/Filter.php
imp/lib/IMP.php
imp/lib/Imap.php
imp/lib/Imap/Acl.php
imp/lib/Imap/Tree.php
imp/lib/Message.php
imp/lib/Prefs/Ui.php
imp/lib/Quota/Command.php
imp/lib/Quota/Hook.php
imp/lib/Quota/Imap.php
imp/lib/Quota/Maildir.php
imp/lib/Quota/Mdaemon.php
imp/lib/Quota/Mercury32.php
imp/lib/Quota/Sql.php
imp/lib/Sentmail.php
imp/lib/Sentmail/Sql.php
imp/pgp.php
imp/smime.php

index b66280b..fde643e 100644 (file)
@@ -1596,7 +1596,7 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base
     {
         try {
             $GLOBALS['imp_imap']->checkUidvalidity($this->_vars->view);
-        } catch (Horde_Exception $e) {
+        } catch (IMP_Exception $e) {
             if (!is_object($result)) {
                 $result = new stdClass;
             }
index 71b5a64..54e2d2c 100644 (file)
@@ -189,6 +189,7 @@ class IMP_Api extends Horde_Registry_Api
      *                        A value of null returns all message types.
      *
      * @return array  A list with the $limit most favourite recipients.
+     * @throws IMP_Exception
      */
     public function favouriteRecipients($limit,
                                         $filter = array('new', 'forward', 'reply', 'redirect'))
index a926d81..33c0754 100644 (file)
@@ -444,6 +444,7 @@ class IMP_Compose
      *                  sent-mail folder.
      * @throws Horde_Exception
      * @throws IMP_Compose_Exception
+     * @throws IMP_Exception
      */
     public function buildAndSendMessage($body, $header, $charset, $html,
                                         $opts = array())
@@ -742,8 +743,11 @@ class IMP_Compose
                 Horde::logMessage('The permission for the maximum number of recipients per time period has been enabled, but no backend for the sent-mail logging has been configured for IMP.', 'ERR');
                 throw new IMP_Compose_Exception(_("The system is not properly configured. A detailed error description has been logged for the administrator."));
             }
-            $sentmail = IMP_Sentmail::factory();
-            $recipients = $sentmail->numberOfRecipients($GLOBALS['conf']['sentmail']['params']['limit_period'], true);
+            try {
+                $recipients = $sentmail->numberOfRecipients($GLOBALS['conf']['sentmail']['params']['limit_period'], true);
+            } catch (IMP_Exception $e) {
+                $recipients = 0;
+            }
             foreach ($result as $address) {
                 $recipients += isset($address['grounpname']) ? count($address['addresses']) : 1;
             }
index 11fdaad..f21fe7d 100644 (file)
@@ -99,7 +99,7 @@ class IMP_Filter
      *                         notification message?
      *
      * @return boolean  True on success.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     protected function _processBWlist($indices, $descrip, $reg1, $reg2, $link)
     {
index de10b37..45cb3b8 100644 (file)
@@ -603,7 +603,7 @@ class IMP
         try {
             $quotaDriver = $GLOBALS['injector']->getInstance('IMP_Quota');
             $quota = $quotaDriver->getQuota();
-        } catch (Exception $e) {
+        } catch (IMP_Exception $e) {
             Horde::logMessage($e, 'ERR');
             return false;
         }
index eeb029f..7450acd 100644 (file)
@@ -306,7 +306,7 @@ class IMP_Imap
      * @param string $mailbox  The mailbox to check. Must be an IMAP mailbox.
      *
      * @return string  The mailbox UIDVALIDITY.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function checkUidvalidity($mailbox)
     {
@@ -327,7 +327,7 @@ class IMP_Imap
         }
 
         if ($this->_uidvalid[$mailbox]) {
-            throw new Horde_Exception(_("Mailbox structure on server has changed."));
+            throw new IMP_Exception(_("Mailbox structure on server has changed."));
         }
 
         return $_SESSION['imp']['cache']['uidvalid'][$mailbox];
index fe766db..a8df2ee 100644 (file)
@@ -31,20 +31,20 @@ class IMP_Imap_Acl
     /**
      * Constructor.
      *
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function __construct()
     {
         if ($_SESSION['imp']['protocol'] != 'imap') {
-            throw new Horde_Exception(_("ACL requires an IMAP server."));
+            throw new IMP_Exception(_("ACL requires an IMAP server."));
         }
 
         if (empty($_SESSION['imp']['imap']['acl'])) {
-            throw new Horde_Exception(_("ACLs not configured for this server."));
+            throw new IMP_Exception(_("ACLs not configured for this server."));
         }
 
         if (!$GLOBALS['imp_imap']->ob()->queryCapability('ACL')) {
-            throw new Horde_Exception(_("IMAP server does not support ACLs."));
+            throw new IMP_Exception(_("IMAP server does not support ACLs."));
         }
 
         $this->_protected = array($GLOBALS['imp_imap']->ob()->getParam('username'));
@@ -121,14 +121,14 @@ class IMP_Imap_Acl
      * @param string $mbox  The mailbox to get the ACL for.
      *
      * @return array  See Horde_Imap_Client_Base::getACL().
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getACL($mbox)
     {
         try {
             return $GLOBALS['imp_imap']->ob()->getACL($mbox);
         } catch (Horde_Imap_Client_Exception $e) {
-            throw new Horde_Exception(_("Could not retrieve ACL"));
+            throw new IMP_Exception(_("Could not retrieve ACL"));
         }
     }
 
@@ -139,14 +139,14 @@ class IMP_Imap_Acl
      * @param string $user  The user to grant rights to.
      * @param array $acl    The rights to be granted.
      *
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function editACL($mbox, $user, $acl)
     {
         try {
             $GLOBALS['imp_imap']->ob()->setACL($mbox, $user, array('remove' => empty($acl), 'rights' => implode('', $acl)));
         } catch (Horde_Imap_Client_Exception $e) {
-            throw new Horde_Exception(sprintf(_("Couldn't give user \"%s\" the following rights for the folder \"%s\": %s"), $user, $mbox, implode('', $acl)));
+            throw new IMP_Exception(sprintf(_("Couldn't give user \"%s\" the following rights for the folder \"%s\": %s"), $user, $mbox, implode('', $acl)));
         }
     }
 
index ddd2b3d..68fa5c9 100644 (file)
@@ -2023,7 +2023,7 @@ class IMP_Imap_Tree
      * @param string $parent  The new mailbox name (UTF7-IMAP).
      *
      * @return string  The full path to the new mailbox.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function createMailboxName($parent, $new)
     {
@@ -2038,7 +2038,7 @@ class IMP_Imap_Tree
                     return $new;
                 }
             }
-            throw new Horde_Exception(_("Cannot directly create mailbox in this folder."));
+            throw new IMP_Exception(_("Cannot directly create mailbox in this folder."));
         }
 
         $mbox = $ns_info['name'];
index b951641..68c302e 100644 (file)
@@ -108,7 +108,7 @@ class IMP_Message
             if (!$error) {
                 try {
                     $GLOBALS['imp_imap']->checkUidvalidity($mbox);
-                } catch (Horde_Exception $e) {
+                } catch (IMP_Exception $e) {
                     $error = $e->getMessage();
                 }
             }
@@ -194,7 +194,7 @@ class IMP_Message
             if (!$error) {
                 try {
                     $GLOBALS['imp_imap']->checkUidvalidity($mbox);
-                } catch (Horde_Exception $e) {
+                } catch (IMP_Exception $e) {
                     $error = $e->getMessage();
                 }
             }
@@ -443,25 +443,25 @@ class IMP_Message
      * @param string $partid  The MIME ID of the part to strip. All parts are
      *                        stripped if null.
      *
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function stripPart($indices, $partid = null)
     {
         /* Return error if no index was provided. */
         if (!($msgList = IMP::parseIndicesList($indices))) {
-            throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
+            throw new IMP_Exception(_("An error occured while attempting to strip the attachment."));
         }
 
         /* If more than one index provided, return error. */
         reset($msgList);
         list($mbox, $index) = each($msgList);
         if (each($msgList) || (count($index) > 1)) {
-            throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
+            throw new IMP_Exception(_("An error occured while attempting to strip the attachment."));
         }
         $index = implode('', $index);
 
         if ($GLOBALS['imp_imap']->isReadOnly($mbox)) {
-            throw new Horde_Exception(_("Cannot strip the MIME part as the mailbox is read-only"));
+            throw new IMP_Exception(_("Cannot strip the MIME part as the mailbox is read-only"));
         }
 
         $GLOBALS['imp_imap']->checkUidvalidity($mbox);
@@ -520,7 +520,7 @@ class IMP_Message
 
             $uid = $GLOBALS['imp_imap']->ob()->append($mbox, array(array('data' => $message->toString(array('headers' => $res['headertext'][0], 'stream' => true)), 'flags' => $res['flags'])));
         } catch (Horde_Imap_Client_Exception $e) {
-            throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
+            throw new IMP_Exception(_("An error occured while attempting to strip the attachment."));
         }
 
         $this->delete($indices, array('nuke' => true, 'keeplog' => true));
@@ -565,7 +565,7 @@ class IMP_Message
             if (!$error) {
                 try {
                     $GLOBALS['imp_imap']->checkUidvalidity($mbox);
-                } catch (Horde_Exception $e) {
+                } catch (IMP_Exception $e) {
                     $error = $e->getMessage();
                 }
             }
@@ -665,7 +665,7 @@ class IMP_Message
             if (is_array($val)) {
                 try {
                     $GLOBALS['imp_imap']->checkUidvalidity($key);
-                } catch (Horde_Exception $e) {
+                } catch (IMP_Exception $e) {
                     continue;
                 }
             }
index 3c6c554..d06c173 100644 (file)
@@ -269,7 +269,7 @@ class IMP_Prefs_Ui
 
         try {
             $GLOBALS['injector']->getInstance('IMP_Imap_Acl');
-        } catch (Exception $e) {
+        } catch (IMP_Exception $e) {
             $ui->suppressGroups[] = 'acl';
         }
 
@@ -637,7 +637,12 @@ class IMP_Prefs_Ui
             ? 'INBOX'
             : $ui->vars->folder;
 
-        $curr_acl = $ACL->getACL($folder);
+        try {
+            $curr_acl = $ACL->getACL($folder);
+        } catch (IMP_Exception $e) {
+            $GLOBALS['notification']->notify($e);
+            return '';
+        }
         $canEdit = $ACL->canEdit($folder, Horde_Auth::getAuth());
 
         $t = $GLOBALS['injector']->createInstance('Horde_Template');
@@ -740,12 +745,18 @@ class IMP_Prefs_Ui
                 } else {
                     $GLOBALS['notification']->push(sprintf(_("All rights on folder \"%s\" successfully removed for user \"%s\"."), $ui->vars->folder, $new_user), 'horde.success');
                 }
-            } catch (Horde_Exception $e) {
+            } catch (IMP_Exception $e) {
                 $GLOBALS['notification']->push($e);
+                return;
             }
         }
 
-        $curr_acl = $ACL->getACL($ui->vars->folder);
+        try {
+            $curr_acl = $ACL->getACL($ui->vars->folder);
+        } catch (IMP_Exception $e) {
+            $GLOBALS['notification']->notify($e);
+            return;
+        }
         $protected = $ACL->getProtected();
 
         foreach ($acl_list as $user => $val) {
@@ -786,7 +797,7 @@ class IMP_Prefs_Ui
                 } else {
                     $GLOBALS['notification']->push(sprintf(_("User \"%s\" successfully given the specified rights for the folder \"%s\"."), $user, $ui->vars->folder), 'horde.success');
                 }
-            } catch (Horde_Exception $e) {
+            } catch (IMP_Exception $e) {
                 $GLOBALS['notification']->push($e);
             }
         }
index 6cbeee8..599086c 100644 (file)
@@ -69,7 +69,7 @@ class IMP_Quota_Command extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
@@ -88,7 +88,7 @@ class IMP_Quota_Command extends IMP_Quota
                         'limit' => $quota[2] * $blocksize);
         }
 
-        throw new Horde_Exception(_("Unable to retrieve quota"));
+        throw new IMP_Exception(_("Unable to retrieve quota"));
     }
 
 }
index b843196..15b902a 100644 (file)
@@ -25,19 +25,19 @@ class IMP_Quota_Hook extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
         try {
             $quota = Horde::callHook('quota', array($this->_params), 'imp');
         } catch (Horde_Exception_HookNotSet $e) {
-            throw new Horde_Exception($e->getMessage());
+            throw new IMP_Exception($e->getMessage());
         }
 
         if (count($quota) != 2) {
             Horde::logMessage('Incorrect number of return values from quota hook.', 'ERR');
-            throw new Horde_Exception(_("Unable to retrieve quota"));
+            throw new IMP_Exception(_("Unable to retrieve quota"));
         }
 
         return array('usage' => $quota[0], 'limit' => $quota[1]);
index e5f5c73..a8860c4 100644 (file)
@@ -21,14 +21,14 @@ class IMP_Quota_Imap extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
         try {
             $quota = $GLOBALS['imp_imap']->ob()->getQuotaRoot($GLOBALS['imp_search']->isSearchMbox($GLOBALS['imp_mbox']['mailbox']) ? 'INBOX' : $GLOBALS['imp_mbox']['mailbox']);
         } catch (Horde_Imap_Client_Exception $e) {
-            throw new Horde_Exception(_("Unable to retrieve quota"));
+            throw new IMP_Exception(_("Unable to retrieve quota"));
         }
 
         if (empty($quota)) {
index 990317d..9235dca 100644 (file)
@@ -42,7 +42,7 @@ class IMP_Quota_Maildir extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
@@ -56,7 +56,7 @@ class IMP_Quota_Maildir extends IMP_Quota
 
         // Read in the quota file and parse it, if possible.
         if (!is_file($full)) {
-            throw new Horde_Exception(_("Unable to retrieve quota"));
+            throw new IMP_Exception(_("Unable to retrieve quota"));
         }
 
         // Read in maildir quota file.
index 9ce8adb..110972c 100644 (file)
@@ -24,7 +24,7 @@ class IMP_Quota_Mdaemon extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
@@ -43,7 +43,7 @@ class IMP_Quota_Mdaemon extends IMP_Quota
             }
         }
 
-        throw new Horde_Exception(_("Unable to retrieve quota"));
+        throw new IMP_Exception(_("Unable to retrieve quota"));
     }
 
     /**
index c6738a5..03de211 100644 (file)
@@ -42,6 +42,7 @@ class IMP_Quota_Mercury32 extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
@@ -59,7 +60,7 @@ class IMP_Quota_Mercury32 extends IMP_Quota
             }
         }
 
-        throw new Horde_Exception(_("Unable to retrieve quota"));
+        throw new IMP_Exception(_("Unable to retrieve quota"));
     }
 
 }
index 3964b4d..4fe36de 100644 (file)
@@ -39,9 +39,9 @@ class IMP_Quota_Sql extends IMP_Quota
     protected $_db;
 
     /**
-     * Connects to the database
+     * Connects to the database.
      *
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     protected function _connect()
     {
@@ -53,7 +53,7 @@ class IMP_Quota_Sql extends IMP_Quota
                                  array('persistent' => !empty($this->_params['persistent']),
                                        'ssl' => !empty($this->_params['ssl'])));
         if ($this->_db instanceof PEAR_Error) {
-            throw new Horde_Exception(_("Unable to connect to SQL server."));
+            throw new IMP_Exception(_("Unable to connect to SQL server."));
         }
     }
 
@@ -63,7 +63,7 @@ class IMP_Quota_Sql extends IMP_Quota
      * @return array  An array with the following keys:
      *                'limit' = Maximum quota allowed
      *                'usage' = Currently used portion of quota (in bytes)
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function getQuota()
     {
@@ -82,7 +82,7 @@ class IMP_Quota_Sql extends IMP_Quota
                                  $this->_params['query_quota']);
             $result = $this->_db->query($query);
             if ($result instanceof PEAR_Error) {
-                throw new Horde_Exception_Prior($result);
+                throw new IMP_Exception($result);
             }
 
             $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
@@ -103,7 +103,7 @@ class IMP_Quota_Sql extends IMP_Quota
                                  $this->_params['query_used']);
             $result = $this->_db->query($query);
             if ($result instanceof PEAR_Error) {
-                throw new Horde_Exception_Prior($result);
+                throw new IMP_Exception($result);
             }
 
             $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
index becf75f..366a511 100644 (file)
@@ -39,7 +39,7 @@ class IMP_Sentmail
             if (class_exists($class)) {
                 try {
                     return new $class($params);
-                } catch (Horde_Exception $e) {}
+                } catch (IMP_Exception $e) {}
             }
         }
 
@@ -49,7 +49,7 @@ class IMP_Sentmail
     /**
      * Constructor.
      *
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     protected function __construct($params = array())
     {
@@ -100,7 +100,7 @@ class IMP_Sentmail
      *                        A value of null returns all message types.
      *
      * @return array  A list with the $limit most favourite recipients.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function favouriteRecipients($limit,
                                         $filter = array('new', 'forward', 'reply', 'redirect'))
@@ -116,7 +116,7 @@ class IMP_Sentmail
      *                        user?
      *
      * @return integer  The number of recipients in the given time period.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function numberOfRecipients($hours, $user = false)
     {
index f5ece53..c223618 100644 (file)
@@ -40,13 +40,17 @@ class IMP_Sentmail_Sql extends IMP_Sentmail
      *
      * @param array $params  A hash containing connection parameters.
      *
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     protected function __construct($params = array())
     {
         parent::__construct($params);
 
-        Horde::assertDriverConfig($this->_params, 'storage', array('phptype', 'table'));
+        try {
+            Horde::assertDriverConfig($this->_params, 'storage', array('phptype', 'table'));
+        } catch (Horde_Exception $e) {
+            throw new IMP_Exception($e);
+        }
 
         if (!isset($this->_params['database'])) {
             $this->_params['database'] = '';
@@ -63,7 +67,7 @@ class IMP_Sentmail_Sql extends IMP_Sentmail
                                  array('persistent' => !empty($this->_params['persistent']),
                                        'ssl' => !empty($this->_params['ssl'])));
         if ($this->_db instanceof PEAR_Error) {
-            throw new Horde_Exception_Prior($this->_db);
+            throw new IMP_Exception($this->_db);
         }
 
         /* Set DB portability options. */
@@ -119,7 +123,7 @@ class IMP_Sentmail_Sql extends IMP_Sentmail
      *                        A value of null returns all message types.
      *
      * @return array  A list with the $limit most favourite recipients.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function favouriteRecipients($limit,
                                         $filter = array('new', 'forward', 'reply', 'redirect'))
@@ -144,7 +148,7 @@ class IMP_Sentmail_Sql extends IMP_Sentmail
         $recipients = $this->_db->getAll($query);
         if ($recipients instanceof PEAR_Error) {
             Horde::logMessage($recipients, 'ERR');
-            throw new Horde_Exception_Prior($recipients);
+            throw new IMP_Exception($recipients);
         }
 
         /* Extract email addresses. */
@@ -164,7 +168,7 @@ class IMP_Sentmail_Sql extends IMP_Sentmail
      *                        user?
      *
      * @return integer  The number of recipients in the given time period.
-     * @throws Horde_Exception
+     * @throws IMP_Exception
      */
     public function numberOfRecipients($hours, $user = false)
     {
@@ -182,7 +186,7 @@ class IMP_Sentmail_Sql extends IMP_Sentmail
         $recipients = $this->_db->getOne($query, array(time() - $hours * 3600));
         if ($recipients instanceof PEAR_Error) {
             Horde::logMessage($recipients, 'ERR');
-            throw new Horde_Exception_Prior($recipients);
+            throw new IMP_Exception($recipients);
         }
 
         return $recipients;
index a45334b..5432374 100644 (file)
@@ -35,7 +35,7 @@ case 'process_import_public_key':
         $imp_pgp->reloadWindow($vars->reload);
     } catch (Horde_Browser_Exception $e) {
         $notification->push(_("No PGP public key imported."), 'horde.error');
-        throw new Horde_Exception_Prior($e);
+        throw new IMP_Exception($e);
     } catch (Horde_Exception $e) {
         $notification->push($e);
         $vars->actionID = 'import_public_key';
@@ -75,7 +75,7 @@ case 'process_import_personal_public_key':
         }
     } catch (Horde_Browser_Exception $e) {
         $notification->push(_("No personal PGP public key imported."), 'horde.error');
-        throw new Horde_Exception_Prior($e);
+        throw new IMP_Exception($e);
     } catch (Horde_Exception $e) {
         $notification->push($e);
         $imp_pgp->importKeyDialog('process_import_personal_public_key', $vars->reload);
@@ -102,7 +102,7 @@ case 'process_import_personal_private_key':
         }
     } catch (Horde_Browser_Exception $e) {
         $notification->push(_("No personal PGP private key imported."), 'horde.error');
-        throw new Horde_Exception_Prior($e);
+        throw new IMP_Exception($e);
     } catch (Horde_Exception $e) {
         $notification->push($e);
         $imp_pgp->importKeyDialog('process_import_personal_private_key', $vars->reload);
index b54cd6e..167083b 100644 (file)
@@ -34,7 +34,7 @@ case 'process_import_public_key':
         $imp_smime->reloadWindow($vars->reload);
     } catch (Horde_Browser_Exception $e) {
         $notification->push(_("No S/MIME public key imported."), 'horde.error');
-        throw new Horde_Exception_Prior($e);
+        throw new IMP_Exception($e);
     } catch (Horde_Exception $e) {
         $notification->push($e);
         $vars->actionID = 'import_public_key';
@@ -79,7 +79,7 @@ case 'process_import_personal_certs':
         $notification->push(_("S/MIME Public/Private Keypair successfully added."), 'horde.success');
         $imp_smime->reloadWindow($vars->reload);
     } catch (Horde_Browser_Exception $e) {
-        throw new Horde_Exception_Prior($e);
+        throw new IMP_Exception($e);
     } catch (Horde_Exception $e) {
         $notification->push(_("Personal S/MIME certificates NOT imported: ") . $e->getMessage(), 'horde.error');
         $vars->actionID = 'import_personal_certs';