| 1 | <?php |
||
| 13 | class ErrorException extends \RuntimeException |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param string $massage |
||
| 17 | * @param int $code |
||
| 18 | * |
||
| 19 | * @return ErrorException |
||
| 20 | */ |
||
| 21 | 2 | public static function failed($massage, $code) |
|
| 22 | { |
||
| 23 | 2 | if ($massage) { |
|
| 24 | 1 | return new self(sprintf('Server returned error "%s".', $massage), $code); |
|
| 25 | } else { |
||
| 26 | 1 | return new self('Server returned an error.', $code); |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $massage |
||
| 32 | * @param int $code |
||
| 33 | * |
||
| 34 | * @return ErrorException |
||
| 35 | */ |
||
| 36 | 1 | public static function invalidResponse($massage, $code) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @param \Exception $e |
||
| 43 | * |
||
| 44 | * @return ErrorException |
||
| 45 | */ |
||
| 46 | 5 | public static function wrap(\Exception $e) |
|
| 50 | } |
||
| 51 |