| 1 | <?php namespace Tarsana\Functional; |
||
| 7 | class Error extends \Exception { |
||
| 8 | /** |
||
| 9 | * Creates a new Error. |
||
| 10 | * ```php |
||
| 11 | * $err = Error::of('Ooops !'); // [Error: Ooops !] |
||
| 12 | * $err2 = Error::of('Second error', $err); // [Error: Second error -> Ooops !] |
||
| 13 | * ``` |
||
| 14 | * |
||
| 15 | * @signature String -> Error |
||
| 16 | * @signature (String, Error) -> Error |
||
| 17 | * @param string $message |
||
| 18 | * @param Error|null $error |
||
| 19 | * @return Error |
||
| 20 | */ |
||
| 21 | public static function of ($message, $code = 0, Error $error = null) |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Returns a string representation of the error. |
||
| 28 | * |
||
| 29 | * @return string |
||
| 30 | */ |
||
| 31 | public function __toString() |
||
| 35 | } |
||
| 36 |