Browse Source

fix conflicts

Taylor Otwell 8 years ago
parent
commit
c131299976
1 changed files with 8 additions and 0 deletions
  1. 8 0
      app/Exceptions/Handler.php

+ 8 - 0
app/Exceptions/Handler.php

@@ -2,7 +2,10 @@
 
 namespace App\Exceptions;
 
+use Exception;
+use Illuminate\Database\Eloquent\ModelNotFoundException;
 use Symfony\Component\HttpKernel\Exception\HttpException;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 
 class Handler extends ExceptionHandler
@@ -14,6 +17,7 @@ class Handler extends ExceptionHandler
      */
     protected $dontReport = [
         HttpException::class,
+        ModelNotFoundException::class,
     ];
 
     /**
@@ -38,6 +42,10 @@ class Handler extends ExceptionHandler
      */
     public function render($request, $e)
     {
+        if ($e instanceof ModelNotFoundException) {
+            $e = new NotFoundHttpException($e->getMessage(), $e);
+        }
+
         return parent::render($request, $e);
     }
 }