Skip to content

Commit 54f70a6

Browse files
committed
Re-register exception handling
1 parent 1448312 commit 54f70a6

File tree

2 files changed

+20
-53
lines changed

2 files changed

+20
-53
lines changed

app/Exceptions/Handler.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

bootstrap/app.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<?php
22

33
use App\Providers\AppServiceProvider;
4+
use Illuminate\Auth\Access\AuthorizationException;
5+
use Illuminate\Auth\AuthenticationException;
6+
use Illuminate\Database\Eloquent\ModelNotFoundException;
47
use Illuminate\Foundation\Application;
58
use Illuminate\Foundation\Configuration\Exceptions;
69
use Illuminate\Foundation\Configuration\Middleware;
10+
use Illuminate\Session\TokenMismatchException;
11+
use Illuminate\Validation\ValidationException;
12+
use Symfony\Component\HttpKernel\Exception\HttpException;
713

814
return Application::configure(basePath: dirname(__DIR__))
915
->withProviders()
@@ -26,5 +32,18 @@
2632
$middleware->throttleApi();
2733
})
2834
->withExceptions(function (Exceptions $exceptions) {
29-
//
35+
$exceptions->dontReport([
36+
AuthenticationException::class,
37+
AuthorizationException::class,
38+
HttpException::class,
39+
ModelNotFoundException::class,
40+
TokenMismatchException::class,
41+
ValidationException::class,
42+
]);
43+
44+
$exceptions->reportable(function (Throwable $e) {
45+
if (app()->bound('sentry')) {
46+
app('sentry')->captureException($e);
47+
}
48+
});
3049
})->create();

0 commit comments

Comments
 (0)