Passed
Push — master ( 4bf73b...23e064 )
by Koen
09:19
created

Handler::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Exceptions;
6
7
use App\Http\Header;
8
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
9
use Throwable;
10
11
final class Handler extends ExceptionHandler
12
{
13
    /**
14
     * A list of the exception types that are not reported.
15
     *
16
     * @var array
17
     */
18
    protected $dontReport = [
19
        //
20
    ];
21
22
    /**
23
     * A list of the inputs that are never flashed for validation exceptions.
24
     *
25
     * @var array
26
     */
27
    protected $dontFlash = [
28
        'password',
29
        'password_confirmation',
30
    ];
31
32
    /**
33
     * Report or log an exception.
34
     *
35
     * @param  \Throwable $e
36
     * @return void
37
     *
38
     * @throws \Exception
39 14
     */
40
    public function report(Throwable $e)
41 14
    {
42
        if ($this->container->bound('sentry') && $this->shouldReport($e)) {
43
            $this->container->make('sentry')->captureException($e);
44
        }
45 14
46 14
        parent::report($e);
47
    }
48
49
    public function render($request, Throwable $e)
50
    {
51
        $request->headers->set(Header::ACCEPT, 'application/json');
52
53
        return parent::render($request, $e);
54
    }
55
}
56