Browse Source

clean up exception handler

Taylor Otwell 7 years ago
parent
commit
758392c30f
1 changed files with 4 additions and 11 deletions
  1. 4 11
      app/Exceptions/Handler.php

+ 4 - 11
app/Exceptions/Handler.php

@@ -14,12 +14,7 @@ class Handler extends ExceptionHandler
      * @var array
      */
     protected $dontReport = [
-        \Illuminate\Auth\AuthenticationException::class,
-        \Illuminate\Auth\Access\AuthorizationException::class,
-        \Symfony\Component\HttpKernel\Exception\HttpException::class,
-        \Illuminate\Database\Eloquent\ModelNotFoundException::class,
-        \Illuminate\Session\TokenMismatchException::class,
-        \Illuminate\Validation\ValidationException::class,
+        //
     ];
 
     /**
@@ -56,10 +51,8 @@ class Handler extends ExceptionHandler
      */
     protected function unauthenticated($request, AuthenticationException $exception)
     {
-        if ($request->expectsJson()) {
-            return response()->json(['error' => 'Unauthenticated.'], 401);
-        }
-
-        return redirect()->guest(route('login'));
+        return $request->expectsJson()
+                    ? response()->json(['error' => 'Unauthenticated.'], 401)
+                    : redirect()->guest(route('login'));
     }
 }