Skip to content

Commit 9967d1e

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 1697d10 + 1070326 commit 9967d1e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

app/Exceptions/Handler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Intervention\Image\Exception\NotSupportedException;
2020
use JsonException;
2121
use League\OAuth2\Server\Exception\OAuthServerException;
22+
use Livewire\Exceptions\ComponentNotFoundException;
2223
use Livewire\Exceptions\PublicPropertyNotFoundException;
2324
use Symfony\Component\HttpKernel\Exception\HttpException;
2425
use Throwable;
@@ -43,6 +44,7 @@ class Handler extends ExceptionHandler
4344
SCIMException::class, // these generally don't need to be reported
4445
InvalidFormatException::class,
4546
PublicPropertyNotFoundException::class,
47+
ComponentNotFoundException::class,
4648
];
4749

4850
/**
@@ -78,6 +80,12 @@ public function render($request, Throwable $e)
7880
return response()->json(['message' => $e->getMessage()], 422);
7981
}
8082

83+
// A request named a Livewire component that doesn't exist in this app (e.g. bots probing
84+
// for Filament endpoints). Return 404 so it doesn't surface as a 500.
85+
if ($e instanceof ComponentNotFoundException) {
86+
return response()->json(['message' => 'Component not found.'], 404);
87+
}
88+
8189
// CSRF token mismatch error
8290
if ($e instanceof TokenMismatchException) {
8391
return redirect()->back()->with('error', trans('general.token_expired'));

0 commit comments

Comments
 (0)