Skip to content

Commit

Permalink
Throw NotFound exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Oct 29, 2013
1 parent ad21226 commit 323cb63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kronolith/lib/Driver/Resource/Sql.php
Expand Up @@ -319,7 +319,7 @@ public function getResource($id)
throw new Kronolith_Exception($e);
}
if (!count($results)) {
throw new Kronolith_Exception('Resource not found');
throw new Horde_Exception_NotFound('Resource not found');
}

$class = 'Kronolith_Resource_' . $results['resource_type'];
Expand Down Expand Up @@ -348,7 +348,7 @@ public function getResourceIdByCalendar($calendar)
throw new Kronolith_Exception($e);
}
if (empty($result)) {
throw new Kronolith_Exception('Resource not found');
throw new Horde_Exception_NotFound('Resource not found');
}

return $result;
Expand Down
7 changes: 5 additions & 2 deletions kronolith/lib/Kronolith.php
Expand Up @@ -2801,8 +2801,11 @@ static public function displayedCalendars()
if (!empty($GLOBALS['display_resource_calendars'])) {
$r_driver = self::getDriver('Resource');
foreach ($GLOBALS['display_resource_calendars'] as $c) {
$resource = $r_driver->getResource($r_driver->getResourceIdByCalendar($c));
$calendars[] = new Kronolith_Calendar_Resource(array('resource' => $resource));
try {
$resource = $r_driver->getResource($r_driver->getResourceIdByCalendar($c));
$calendars[] = new Kronolith_Calendar_Resource(array('resource' => $resource));
} catch (Horde_Exception_NotFound $e) {
}
}
}
return $calendars;
Expand Down

0 comments on commit 323cb63

Please sign in to comment.