1 | <?php |
||
29 | trait HandlesApiErrors |
||
30 | { |
||
31 | /** |
||
32 | * Convert a Laravel exception to an API exception. |
||
33 | * |
||
34 | * @param \Exception $exception |
||
35 | * @return void |
||
36 | */ |
||
37 | 7 | protected function transformException(Exception $exception) |
|
43 | |||
44 | /** |
||
45 | * Convert a Laravel HTTP exception to an API exception. |
||
46 | * |
||
47 | * @param \Exception $exception |
||
48 | * @return void |
||
49 | * @throws \Flugg\Responder\Exceptions\Http\PageNotFoundException |
||
50 | */ |
||
51 | 7 | protected function transformHttpException(Exception $exception) |
|
65 | |||
66 | /** |
||
67 | * Convert an Eloquent exception to an API exception. |
||
68 | * |
||
69 | * @param \Exception $exception |
||
70 | * @return void |
||
71 | * @throws \Flugg\Responder\Exceptions\Http\ResourceNotFoundException |
||
72 | * @throws \Flugg\Responder\Exceptions\Http\RelationNotFoundException |
||
73 | */ |
||
74 | 5 | protected function transformEloquentException(Exception $exception) |
|
84 | |||
85 | /** |
||
86 | * Convert a Laravel validation exception to an API exception. |
||
87 | * |
||
88 | * @param \Exception $exception |
||
89 | * @return void |
||
90 | * @throws \Flugg\Responder\Exceptions\Http\ValidationFailedException |
||
91 | */ |
||
92 | 3 | protected function transformValidationException(Exception $exception) |
|
98 | |||
99 | /** |
||
100 | * Convert API exceptions to error responses. |
||
101 | * |
||
102 | * @param \Flugg\Responder\Exceptions\Http\ApiException $exception |
||
103 | * @return \Illuminate\Http\JsonResponse |
||
104 | */ |
||
105 | 1 | protected function renderApiError(ApiException $exception): JsonResponse |
|
112 | } |