catch exceptions from Ansel_Storage
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 12 Sep 2010 16:25:03 +0000 (12:25 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 12 Sep 2010 19:40:47 +0000 (15:40 -0400)
ansel/img/upload_preview.php

index c28e54c..b73b4d0 100644 (file)
 
 require_once dirname(__FILE__) . '/../lib/Application.php';
 Horde_Registry::appInit('ansel');
-$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery((int)Horde_Util::getFormData('gallery'));
+try {
+    $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery((int)Horde_Util::getFormData('gallery'));
+} catch (Ansel_Exception $e) {
+    echo $e->getMessage();
+    Horde::logMessage($e->getMessage(), 'err');
+    exit;
+}
 if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::READ)) {
     throw new Horde_Exception_PermissionDenied();
 }