Skip to content

Commit c131299

Browse files
committed
fix conflicts
2 parents 350a0f1 + 395b69b commit c131299

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/Exceptions/Handler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
namespace App\Exceptions;
44

5+
use Exception;
6+
use Illuminate\Database\Eloquent\ModelNotFoundException;
57
use Symfony\Component\HttpKernel\Exception\HttpException;
8+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
69
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
710

811
class Handler extends ExceptionHandler
@@ -14,6 +17,7 @@ class Handler extends ExceptionHandler
1417
*/
1518
protected $dontReport = [
1619
HttpException::class,
20+
ModelNotFoundException::class,
1721
];
1822

1923
/**
@@ -38,6 +42,10 @@ public function report($e)
3842
*/
3943
public function render($request, $e)
4044
{
45+
if ($e instanceof ModelNotFoundException) {
46+
$e = new NotFoundHttpException($e->getMessage(), $e);
47+
}
48+
4149
return parent::render($request, $e);
4250
}
4351
}

0 commit comments

Comments
 (0)