Passed
Pull Request — master (#2)
by ANTHONIUS
05:01
created

Handler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 43
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A report() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the EOffice project.
5
 *
6
 * (c) Anthonius Munthi <https://itstoni.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace EOffice\Core\Exceptions;
15
16
use Exception;
17
use Illuminate\Auth\Access\AuthorizationException;
18
use Illuminate\Database\Eloquent\ModelNotFoundException;
19
use Illuminate\Http\JsonResponse;
20
use Illuminate\Http\Request;
21
use Illuminate\Http\Response;
22
use Illuminate\Validation\ValidationException;
23
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
24
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
25
use Symfony\Component\HttpKernel\Exception\HttpException;
26
use Throwable;
27
28
class Handler extends ExceptionHandler
29
{
30
    /**
31
     * A list of the exception types that should not be reported.
32
     *
33
     * @var array
34
     */
35
    protected $dontReport = [
36
        AuthorizationException::class,
37
        HttpException::class,
38
        ModelNotFoundException::class,
39
        ValidationException::class,
40
    ];
41
42
    /**
43
     * Report or log an exception.
44
     *
45
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
46
     *
47
     * @param Throwable $e
48
     *
49
     * @throws Exception
50
     *
51
     * @return void
52
     */
53
    public function report(Throwable $e)
54
    {
55
        parent::report($e);
56
    }
57
58
    /**
59
     * Render an exception into an HTTP response.
60
     *
61
     * @param Request   $request
62
     * @param Throwable $e
63
     *
64
     * @throws Throwable
65
     *
66
     * @return Response|JsonResponse|SymfonyResponse
67
     */
68
    public function render($request, Throwable $e)
69
    {
70
        return parent::render($request, $e);
71
    }
72
}
73