root/trunk/classes/phing/ConfigurationException.php
| Revision 307, 2.3 kB (checked in by hans, 1 year ago) |
|---|
| Line | |
|---|---|
| 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 | namespace phing; |
| 23 | |
| 24 | /** |
| 25 | * ConfigurationException is thrown by Phing during the configuration and setup phase of the project. |
| 26 | * |
| 27 | * @author Hans Lellelid <hans@xmpl.org> |
| 28 | * @version $Revision$ |
| 29 | * @package phing |
| 30 | */ |
| 31 | class ConfigurationException extends Exception { |
| 32 | |
| 33 | /** |
| 34 | * Location in the xml file. |
| 35 | * @var Location |
| 36 | */ |
| 37 | protected $location; |
| 38 | |
| 39 | /** |
| 40 | * The nested "cause" exception. |
| 41 | * @var Exception |
| 42 | */ |
| 43 | protected $cause; |
| 44 | |
| 45 | /** |
| 46 | * Construct a BuildException. |
| 47 | * Supported signatures: |
| 48 | * throw new BuildException($causeExc); |
| 49 | * throw new BuildException($msg); |
| 50 | * throw new BuildException($msg, $causeExc); |
| 51 | */ |
| 52 | function __construct($p1, $p2 = null, $p3 = null) { |
| 53 | |
| 54 | $cause = null; |
| 55 | $msg = ""; |
| 56 | |
| 57 | if ($p2 !== null) { |
| 58 | if ($p2 instanceof Exception) { |
| 59 | $cause = $p2; |
| 60 | $msg = $p1; |
| 61 | } |
| 62 | } elseif ($p1 instanceof Exception) { |
| 63 | $cause = $p1; |
| 64 | } else { |
| 65 | $msg = $p1; |
| 66 | } |
| 67 | |
| 68 | parent::__construct($msg); |
| 69 | |
| 70 | if ($cause !== null) { |
| 71 | $this->cause = $cause; |
| 72 | $this->message .= " [wrapped: " . $cause->getMessage() ."]"; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Gets the cause exception. |
| 78 | * |
| 79 | * @return Exception |
| 80 | */ |
| 81 | public function getCause() { |
| 82 | return $this->cause; |
| 83 | } |
| 84 | |
| 85 | } |
| 86 |
Note: See TracBrowser for help on using the browser.
