From: Chuck Hagenbuch Date: Wed, 15 Jul 2009 01:43:09 +0000 (-0400) Subject: catch exceptions during API calls to re-throw, so that we can make sure to call popApp() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=afb64ee00185aa9bcbeb3f52f6c7d70934ce1ed8;p=horde.git catch exceptions during API calls to re-throw, so that we can make sure to call popApp() --- diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index eb227c6aa..e34dc3d12 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -600,7 +600,11 @@ class Horde_Registry * error immediately if pushApp() fails. */ $pushed = $this->pushApp($app, $checkPerms); - $res = call_user_func_array($function, $args); + try { + $result = call_user_func_array($function, $args); + } catch (Horde_Exception $e) { + $result = $e; + } /* If we changed application context in the course of this * call, undo that change now. */ @@ -608,11 +612,14 @@ class Horde_Registry $this->popApp(); } - if (is_a($res, 'PEAR_Error')) { - throw new Horde_Exception($res); + if ($result instanceof Exception) { + throw $e; + } + if (is_a($result, 'PEAR_Error')) { + throw new Horde_Exception($result); } - return $res; + return $result; } /** @@ -1093,9 +1100,9 @@ class Horde_Registry if ($this->_cacheob && ($id = $this->_getCacheId($name))) { - $res = $this->_cacheob->get($id, 86400); - if ($res !== false) { - $this->_cache[$name] = unserialize($res); + $result = $this->_cacheob->get($id, 86400); + if ($result !== false) { + $this->_cache[$name] = unserialize($result); Horde::logMessage('Horde_Registry: retrieved ' . $name . ' with cache ID ' . $id, __FILE__, __LINE__, PEAR_LOG_DEBUG); return true; }