this throws a Turba_Exception, not a PEAR_Error
authorMichael J Rubinsky <mrubinsk@horde.org>
Fri, 7 Jan 2011 19:23:39 +0000 (14:23 -0500)
committerMichael J Rubinsky <mrubinsk@horde.org>
Fri, 7 Jan 2011 19:32:39 +0000 (14:32 -0500)
turba/addressbooks/create.php

index 61cad1d..ecfcc0c 100644 (file)
@@ -24,11 +24,11 @@ $form = new Turba_Form_CreateAddressBook($vars);
 
 // Execute if the form is valid.
 if ($form->validate($vars)) {
-    $result = $form->execute();
-    if ($result instanceof PEAR_Error) {
-        $notification->push($result, 'horde.error');
-    } else {
+    try {
+        $result = $form->execute();
         $notification->push(sprintf(_("The address book \"%s\" has been created."), $vars->get('name')), 'horde.success');
+    } catch (Turba_Exception $e) {
+        $notification->push($e, 'horde.error');
     }
 
     Horde::url('addressbooks/', true)->redirect();