From: Michael J. Rubinsky Date: Wed, 8 Sep 2010 21:06:23 +0000 (-0400) Subject: Catch exceptions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3ea705ebaba4710d1d8cafec1c314114f8746588;p=horde.git Catch exceptions --- diff --git a/ansel/lib/Tagger.php b/ansel/lib/Tagger.php index 02690cc16..f4c90cf23 100644 --- a/ansel/lib/Tagger.php +++ b/ansel/lib/Tagger.php @@ -42,7 +42,11 @@ class Ansel_Tagger $this->_type_ids = unserialize($ids); } else { $type_mgr = $GLOBALS['injector']->getInstance('Content_Types_Manager'); - $types = $type_mgr->ensureTypes(array('gallery', 'image')); + try { + $types = $type_mgr->ensureTypes(array('gallery', 'image')); + } catch (Content_Exception $e) { + throw new Ansel_Exception($e); + } $this->_type_ids = array('gallery' => (int)$types[0], 'image' => (int)$types[1]); $GLOBALS['injector']->getInstance('Horde_Cache')->set($key, serialize($this->_type_ids)); diff --git a/ansel/lib/Widget/Tags.php b/ansel/lib/Widget/Tags.php index 160e3e6c7..7a2ac730f 100644 --- a/ansel/lib/Widget/Tags.php +++ b/ansel/lib/Widget/Tags.php @@ -32,7 +32,11 @@ class Ansel_Widget_Tags extends Ansel_Widget_Base /* Build the tag widget */ $html = $this->_htmlBegin(); - $html .= '
' . $this->_getTagHTML() . '
'; + try { + $html .= '
' . $this->_getTagHTML() . '
'; + } catch (Ansel_Exception $e) { + return $html . sprintf(_("There was an error fetching tags: %s"), $e->getMessage()) . $this->_htmlEnd(); + } if ($this->_view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { Horde::startBuffer(); /* Attach the Ajax action */