Skip to content

A free open source IT asset/license management system

Livewire: Added ComponentNotFoundException to $dontReport

snipe10703263a862
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index aab74bfe0a..ff30bc8216 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -19,6 +19,7 @@ use Illuminate\Validation\ValidationException;
use Intervention\Image\Exception\NotSupportedException;
use JsonException;
use League\OAuth2\Server\Exception\OAuthServerException;
+use Livewire\Exceptions\ComponentNotFoundException;
use Livewire\Exceptions\PublicPropertyNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
@@ -43,6 +44,7 @@ class Handler extends ExceptionHandler
SCIMException::class, // these generally don't need to be reported
InvalidFormatException::class,
PublicPropertyNotFoundException::class,
+ ComponentNotFoundException::class,
];
/**
@@ -78,6 +80,12 @@ class Handler extends ExceptionHandler
return response()->json(['message' => $e->getMessage()], 422);
}
+ // A request named a Livewire component that doesn't exist in this app (e.g. bots probing
+ // for Filament endpoints). Return 404 so it doesn't surface as a 500.
+ if ($e instanceof ComponentNotFoundException) {
+ return response()->json(['message' => 'Component not found.'], 404);
+ }
+
// CSRF token mismatch error
if ($e instanceof TokenMismatchException) {
return redirect()->back()->with('error', trans('general.token_expired'));