Skip to content

Commit b069ff0

Browse files
committed
update exception handler with AuthenticationException
1 parent 6dfc022 commit b069ff0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/Exceptions/Handler.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Exceptions;
44

55
use Exception;
6+
use Illuminate\Auth\AuthenticationException;
67
use Illuminate\Validation\ValidationException;
78
use Illuminate\Auth\Access\AuthorizationException;
89
use Illuminate\Database\Eloquent\ModelNotFoundException;
@@ -17,12 +18,25 @@ class Handler extends ExceptionHandler
1718
* @var array
1819
*/
1920
protected $dontReport = [
21+
AuthenticationException::class,
2022
AuthorizationException::class,
2123
HttpException::class,
2224
ModelNotFoundException::class,
2325
ValidationException::class,
2426
];
2527

28+
/**
29+
* Convert an authentication exception into an unauthenticated response.
30+
*
31+
* @param \Illuminate\Http\Request $request
32+
* @param \Illuminate\Auth\AuthenticationException $e
33+
* @return \Symfony\Component\HttpFoundation\Response
34+
*/
35+
protected function unauthenticated($request, AuthenticationException $e)
36+
{
37+
parent::unauthenticated($request, $e);
38+
}
39+
2640
/**
2741
* Report or log an exception.
2842
*

0 commit comments

Comments
 (0)