|
Revision 1, 3.1 kB
(checked in by hans, 3 years ago)
|
Initial checkin
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
class BuildException extends Exception { |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
protected $location = null; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
protected $cause; |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
* Construct a BuildException. |
|---|
| 39 |
* Supported signatures: |
|---|
| 40 |
* throw new BuildException($causeExc); |
|---|
| 41 |
* throw new BuildException($msg); |
|---|
| 42 |
* throw new Buildexception($causeExc, $loc); |
|---|
| 43 |
* throw new BuildException($msg, $causeExc); |
|---|
| 44 |
* throw new BuildException($msg, $loc); |
|---|
| 45 |
* throw new BuildException($msg, $causeExc, $loc); |
|---|
| 46 |
*/ |
|---|
| 47 |
function __construct($p1, $p2 = null, $p3 = null) { |
|---|
| 48 |
|
|---|
| 49 |
$cause = null; |
|---|
| 50 |
$loc = null; |
|---|
| 51 |
$msg = ""; |
|---|
| 52 |
|
|---|
| 53 |
if ($p3 !== null) { |
|---|
| 54 |
$cause = $p2; |
|---|
| 55 |
$loc = $p3; |
|---|
| 56 |
$msg = $p1; |
|---|
| 57 |
} elseif ($p2 !== null) { |
|---|
| 58 |
if ($p2 instanceof Exception) { |
|---|
| 59 |
$cause = $p2; |
|---|
| 60 |
$msg = $p1; |
|---|
| 61 |
} elseif ($p2 instanceof Location) { |
|---|
| 62 |
$loc = $p2; |
|---|
| 63 |
if ($p1 instanceof Exception) { |
|---|
| 64 |
$cause = $p1; |
|---|
| 65 |
} else { |
|---|
| 66 |
$msg = $p1; |
|---|
| 67 |
} |
|---|
| 68 |
} |
|---|
| 69 |
} elseif ($p1 instanceof Exception) { |
|---|
| 70 |
$cause = $p1; |
|---|
| 71 |
} else { |
|---|
| 72 |
$msg = $p1; |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
parent::__construct($msg); |
|---|
| 76 |
|
|---|
| 77 |
if ($cause !== null) { |
|---|
| 78 |
$this->cause = $cause; |
|---|
| 79 |
$this->message .= " [wrapped: " . $cause->getMessage() ."]"; |
|---|
| 80 |
} |
|---|
| 81 |
|
|---|
| 82 |
if ($loc !== null) { |
|---|
| 83 |
$this->setLocation($loc); |
|---|
| 84 |
} |
|---|
| 85 |
} |
|---|
| 86 |
|
|---|
| 87 |
function getCause() { |
|---|
| 88 |
return $this->cause; |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
function getLocation() { |
|---|
| 92 |
return $this->location; |
|---|
| 93 |
} |
|---|
| 94 |
|
|---|
| 95 |
function setLocation($loc) { |
|---|
| 96 |
$this->location = $loc; |
|---|
| 97 |
$this->message = $loc->toString() . ': ' . $this->message; |
|---|
| 98 |
} |
|---|
| 99 |
|
|---|
| 100 |
} |
|---|
| 101 |
|
|---|