From 3ea705ebaba4710d1d8cafec1c314114f8746588 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Wed, 8 Sep 2010 17:06:23 -0400 Subject: [PATCH] Catch exceptions --- ansel/lib/Tagger.php | 6 +++++- ansel/lib/Widget/Tags.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 */ -- 2.11.0