From: Gunnar Wrobel
Date: Thu, 11 Feb 2010 10:56:27 +0000 (+0100) Subject: Support previous exceptions in PHP < 5.3.0. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=57929daa4b698e3888c966a9477aafe9fb2a0d7a;p=horde.git Support previous exceptions in PHP < 5.3.0. Taken from http://framework.zend.com/wiki/display/ZFPROP/previous+Exception+on+Zend_Exception+-+Marc+Bennewitz --- diff --git a/framework/Exception/lib/Horde/Exception.php b/framework/Exception/lib/Horde/Exception.php index 2c2553d33..2ce637541 100644 --- a/framework/Exception/lib/Horde/Exception.php +++ b/framework/Exception/lib/Horde/Exception.php @@ -1,15 +1,75 @@ _previous = $previous; + } + + /** + * Returns previous Exception + * + * @return Exception|null + */ + final public function getPrevious() + { + return $this->_previous; + } + + /** + * String representation of the exception + * + * @return string + */ + public function __toString() + { + if ($this->getPrevious()) { + return $this->getPrevious()->__toString() . "\n\nNext " . parent::__toString(); + } else { + return parent::__toString(); + } + } + + } +} else { + /** + * Horde base exception class. + * + * Copyright 2008-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Horde_Exception + */ + class Horde_Exception extends Exception + { + } +} \ No newline at end of file