Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| AppException | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| fromException | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Exceptions; |
| 4 | |
| 5 | class AppException extends \Exception |
| 6 | { |
| 7 | public string $exceptionCode = ''; |
| 8 | |
| 9 | public static function fromException(\Throwable $e, string $exceptionCode): self |
| 10 | { |
| 11 | $appException = new self($e->getMessage(), (int) $e->getCode(), $e); |
| 12 | $appException->exceptionCode = $exceptionCode; |
| 13 | |
| 14 | return $appException; |
| 15 | } |
| 16 | } |