Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
 *  $Id: PropelException.php 1262 2009-10-26 20:54:39Z francois $
4
 *
5
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16
 *
17
 * This software consists of voluntary contributions made by many individuals
18
 * and is licensed under the LGPL. For more information please see
19
 * <http://propel.phpdb.org>.
20
 */
21
 
22
/**
23
 * The base class of all exceptions thrown by Propel.
24
 * @author     Hans Lellelid <hans@xmpl.org>
25
 * @version    $Revision: 1262 $
26
 * @package    propel
27
 */
28
class PropelException extends Exception {
29
 
30
	/** The nested "cause" exception. */
31
	protected $cause;
32
 
33
	function __construct($p1, $p2 = null) {
34
 
35
		$cause = null;
36
 
37
		if ($p2 !== null) {
38
			$msg = $p1;
39
			$cause = $p2;
40
		} else {
41
			if ($p1 instanceof Exception) {
42
				$msg = "";
43
				$cause = $p1;
44
			} else {
45
				$msg = $p1;
46
			}
47
		}
48
 
49
		parent::__construct($msg);
50
 
51
		if ($cause !== null) {
52
			$this->cause = $cause;
53
			$this->message .= " [wrapped: " . $cause->getMessage() ."]";
54
		}
55
	}
56
 
57
	function getCause() {
58
		return $this->cause;
59
	}
60
 
61
}