[dev] Patch for error handling in kronolith

Jason Rust jrust at rustyparts.com
Fri May 16 11:31:28 PDT 2003


The attached patch adds a bit of error handling for when there is an
error in saving an event (which can esp. happen if sequences can't be
created.).

-Jason

-- 
http://www.rustyparts.com/
puttin' some rust into it!
-------------- next part --------------
Index: addeventaction.php
===================================================================
RCS file: /repository/kronolith/addeventaction.php,v
retrieving revision 1.36
diff -u -r1.36 addeventaction.php
--- addeventaction.php	8 May 2003 13:31:18 -0000	1.36
+++ addeventaction.php	16 May 2003 18:25:37 -0000
@@ -22,7 +22,10 @@
         $calendar->open($calendar_id);
         $event = $calendar->getEventObject();
         $event->readForm();
-        $event->save();
+        $res = $event->save();
+        if (is_a($res, 'PEAR_Error')) {
+            $notification->push(sprintf(_("There was an error in adding the event.  The server said: %s"), $res->getMessage()), 'horde.error');
+        }
     }
 }
 
Index: editeventaction.php
===================================================================
RCS file: /repository/kronolith/editeventaction.php,v
retrieving revision 1.43
diff -u -r1.43 editeventaction.php
--- editeventaction.php	10 May 2003 00:46:12 -0000	1.43
+++ editeventaction.php	16 May 2003 18:25:37 -0000
@@ -62,7 +62,10 @@
                 }
             }
             $event->readForm();
-            $event->save();
+            $res = $event->save();
+            if (is_a($res, 'PEAR_Error')) {
+                $notification->push(sprintf(_("There was an error in editing the event.  The server said: %s"), $res->getMessage()), 'horde.error');
+            }
         }
     }
 }


More information about the dev mailing list