| 1 |
lars |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* $Id: BuildException.php 123 2006-09-14 20:19:08Z mrook $
|
|
|
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://phing.info>.
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* ConfigurationException is thrown by Phing during the configuration and setup phase of the project.
|
|
|
24 |
*
|
|
|
25 |
* @author Hans Lellelid <hans@xmpl.org>
|
|
|
26 |
* @version $Revision$
|
|
|
27 |
* @package phing
|
|
|
28 |
*/
|
|
|
29 |
class ConfigurationException extends Exception {
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* Location in the xml file.
|
|
|
33 |
* @var Location
|
|
|
34 |
*/
|
|
|
35 |
protected $location;
|
|
|
36 |
|
|
|
37 |
/**
|
|
|
38 |
* The nested "cause" exception.
|
|
|
39 |
* @var Exception
|
|
|
40 |
*/
|
|
|
41 |
protected $cause;
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Construct a BuildException.
|
|
|
45 |
* Supported signatures:
|
|
|
46 |
* throw new BuildException($causeExc);
|
|
|
47 |
* throw new BuildException($msg);
|
|
|
48 |
* throw new BuildException($msg, $causeExc);
|
|
|
49 |
*/
|
|
|
50 |
function __construct($p1, $p2 = null, $p3 = null) {
|
|
|
51 |
|
|
|
52 |
$cause = null;
|
|
|
53 |
$msg = "";
|
|
|
54 |
|
|
|
55 |
if ($p2 !== null) {
|
|
|
56 |
if ($p2 instanceof Exception) {
|
|
|
57 |
$cause = $p2;
|
|
|
58 |
$msg = $p1;
|
|
|
59 |
}
|
|
|
60 |
} elseif ($p1 instanceof Exception) {
|
|
|
61 |
$cause = $p1;
|
|
|
62 |
} else {
|
|
|
63 |
$msg = $p1;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
parent::__construct($msg);
|
|
|
67 |
|
|
|
68 |
if ($cause !== null) {
|
|
|
69 |
$this->cause = $cause;
|
|
|
70 |
$this->message .= " [wrapped: " . $cause->getMessage() ."]";
|
|
|
71 |
}
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
* Gets the cause exception.
|
|
|
76 |
*
|
|
|
77 |
* @return Exception
|
|
|
78 |
*/
|
|
|
79 |
public function getCause() {
|
|
|
80 |
return $this->cause;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
}
|