1 | <?php |
||
27 | trait HandlesApiErrors |
||
28 | { |
||
29 | /** |
||
30 | * Convert a Laravel exception to an API exception. |
||
31 | * |
||
32 | * @param \Exception $exception |
||
33 | * @return void |
||
34 | */ |
||
35 | protected function transformException(Exception $exception) |
||
41 | |||
42 | /** |
||
43 | * Convert a Laravel auth exception to an API exception. |
||
44 | * |
||
45 | * @param \Exception $exception |
||
46 | * @return void |
||
47 | * @throws UnauthenticatedException |
||
48 | * @throws UnauthorizedException |
||
49 | */ |
||
50 | protected function transformAuthException(Exception $exception) |
||
60 | |||
61 | /** |
||
62 | * Convert an Eloquent exception to an API exception. |
||
63 | * |
||
64 | * @param Exception $exception |
||
65 | * @return void |
||
66 | * @throws ResourceNotFoundException |
||
67 | * @throws RelationNotFoundException |
||
68 | */ |
||
69 | protected function transformEloquentException(Exception $exception) |
||
79 | |||
80 | /** |
||
81 | * Convert a Laravel validation exception to an API exception. |
||
82 | * |
||
83 | * @param Exception $exception |
||
84 | * @return void |
||
85 | * @throws ValidationFailedException |
||
86 | */ |
||
87 | protected function transformValidationException(Exception $exception) |
||
93 | |||
94 | /** |
||
95 | * Convert API exceptions to error responses. |
||
96 | * |
||
97 | * @param \Flugg\Responder\Exceptions\Http\ApiException $exception |
||
98 | * @return \Illuminate\Http\JsonResponse |
||
99 | */ |
||
100 | protected function renderApiError(ApiException $exception): JsonResponse |
||
107 | } |