Check for cases where resource is not found
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 18 Aug 2009 16:19:30 +0000 (12:19 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 29 Sep 2009 20:53:48 +0000 (16:53 -0400)
kronolith/lib/Driver/Sql.php
kronolith/resources.php

index 8e77e7e..25a3999 100644 (file)
@@ -804,7 +804,11 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
         if ($results instanceof PEAR_Error) {
             throw new Horde_Exception($results->getMessage());
         }
+        if (empty($results)) {
+            throw new Horde_Exception('Resource not found');
+        }
         $return = array();
+        var_dump($results);
         foreach ($results as $field => $value) {
             $return[str_replace('resource_', '', $field)] = $this->convertFromDriver($value);
         }
index be3c901..e15ba9a 100644 (file)
@@ -17,4 +17,4 @@ $new = array('name' => _("N329SP"),
 //var_dump($results);
 
 /* Test adding resource to event */
-var_dump(Kronolith_Resource::getResource(5));
\ No newline at end of file
+var_dump(Kronolith_Resource::getResource(6));
\ No newline at end of file