expressolivretools / app / Exceptions / Handler.php @ 3e379cec
Histórico | Ver | Anotar | Baixar (1,34 KB)
1 | 3e379cec | Alexandre Correia | <?php
|
---|---|---|---|
2 | |||
3 | namespace App\Exceptions; |
||
4 | |||
5 | use Illuminate\Auth\Access\AuthorizationException; |
||
6 | use Illuminate\Database\Eloquent\ModelNotFoundException; |
||
7 | use Illuminate\Validation\ValidationException; |
||
8 | use Laravel\Lumen\Exceptions\Handler as ExceptionHandler; |
||
9 | use Symfony\Component\HttpKernel\Exception\HttpException; |
||
10 | use Throwable; |
||
11 | |||
12 | class Handler extends ExceptionHandler |
||
13 | { |
||
14 | /**
|
||
15 | * A list of the exception types that should not be reported.
|
||
16 | *
|
||
17 | * @var array
|
||
18 | */
|
||
19 | protected $dontReport = [ |
||
20 | AuthorizationException::class, |
||
21 | HttpException::class, |
||
22 | ModelNotFoundException::class, |
||
23 | ValidationException::class, |
||
24 | ]; |
||
25 | |||
26 | /**
|
||
27 | * Report or log an exception.
|
||
28 | *
|
||
29 | * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||
30 | *
|
||
31 | * @param \Throwable $exception
|
||
32 | * @return void
|
||
33 | *
|
||
34 | * @throws \Exception
|
||
35 | */
|
||
36 | public function report(Throwable $exception) |
||
37 | { |
||
38 | parent::report($exception); |
||
39 | } |
||
40 | |||
41 | /**
|
||
42 | * Render an exception into an HTTP response.
|
||
43 | *
|
||
44 | * @param \Illuminate\Http\Request $request
|
||
45 | * @param \Throwable $exception
|
||
46 | * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||
47 | *
|
||
48 | * @throws \Throwable
|
||
49 | */
|
||
50 | public function render($request, Throwable $exception) |
||
51 | { |
||
52 | return parent::render($request, $exception); |
||
53 | } |
||
54 | } |