From: Ben Klang Date: Wed, 13 Jan 2010 15:08:47 +0000 (-0500) Subject: Shout: Catch startup exceptions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a0c51e6f0391ee7b5c278aa138b0c9ba42ba5817;p=horde.git Shout: Catch startup exceptions --- diff --git a/shout/devices.php b/shout/devices.php index 6c1d00bfc..361530192 100644 --- a/shout/devices.php +++ b/shout/devices.php @@ -98,7 +98,12 @@ default: } // Fetch the (possibly updated) list of extensions -$devices = $shout->devices->getDevices($context); +try { + $devices = $shout->devices->getDevices($context); +} catch (Exception $e) { + $notification->push($e); + $devices = array(); +} Horde::addScriptFile('stripe.js', 'horde'); require SHOUT_TEMPLATES . '/common-header.inc'; diff --git a/shout/extensions.php b/shout/extensions.php index b7f9684b4..6378ba20d 100644 --- a/shout/extensions.php +++ b/shout/extensions.php @@ -97,8 +97,14 @@ default: $title .= _("List Users"); } + // Fetch the (possibly updated) list of extensions -$extensions = $shout->extensions->getExtensions($context); +try { + $extensions = $shout->extensions->getExtensions($context); +} catch (Exception $e) { + $notification->push($e); + $extensions = array(); +} Horde::addScriptFile('stripe.js', 'horde'); Horde::addScriptFile('prototype.js', 'horde'); diff --git a/shout/lib/Application.php b/shout/lib/Application.php index 75deba22e..7e7a9fad5 100644 --- a/shout/lib/Application.php +++ b/shout/lib/Application.php @@ -44,11 +44,16 @@ class Shout_Application extends Horde_Registry_Application $GLOBALS['registry'] = &Horde_Registry::singleton(); $registry = &$GLOBALS['registry']; try { - $registry->pushApp('shout', array('check_perms' => true, - 'logintasks' => true)); + $registry->pushApp('shout'); } catch (Horde_Exception $e) { Horde_Auth::authenticateFailure('shout', $e); } + $conf = &$GLOBALS['conf']; + + // Notification system. + $GLOBALS['notification'] = &Horde_Notification::singleton(); + $notification = &$GLOBALS['notification']; + $notification->attach('status'); define('SHOUT_TEMPLATES', $registry->get('templates')); @@ -63,10 +68,6 @@ class Shout_Application extends Horde_Registry_Application $contexts = false; } - $notification = &Horde_Notification::singleton(); - $GLOBALS['notification'] = $notification; - $notification->attach('status'); - if (count($contexts) == 1) { // Default to the user's only context if (!empty($context) && $context != $contexts[0]) { diff --git a/shout/lib/Driver/Sql.php b/shout/lib/Driver/Sql.php index 4dead6476..7f191a5cd 100644 --- a/shout/lib/Driver/Sql.php +++ b/shout/lib/Driver/Sql.php @@ -59,12 +59,12 @@ class Shout_Driver_Sql extends Shout_Driver Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_DEBUG); $result = $this->_db->query($sql, $vars); if ($result instanceof PEAR_Error) { - throw Shout_Exception($result); + throw new Shout_Exception($result); } $row = $result->fetchRow(DB_FETCHMODE_ASSOC); if ($row instanceof PEAR_Error) { - throw Shout_Exception($row); + throw new Shout_Exception($row); } $contexts = array(); diff --git a/shout/lib/Exception.php b/shout/lib/Exception.php index 301bcf7d8..97803302d 100644 --- a/shout/lib/Exception.php +++ b/shout/lib/Exception.php @@ -1,4 +1,2 @@