From 57929daa4b698e3888c966a9477aafe9fb2a0d7a Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Thu, 11 Feb 2010 11:56:27 +0100 Subject: [PATCH] Support previous exceptions in PHP < 5.3.0. Taken from http://framework.zend.com/wiki/display/ZFPROP/previous+Exception+on+Zend_Exception+-+Marc+Bennewitz --- framework/Exception/lib/Horde/Exception.php | 88 ++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 14 deletions(-) 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 -- 2.11.0