From a0d4699cdf528b8edbbdd9c7ab6485355bd433d9 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 17 Jun 2026 13:39:08 +0200 Subject: [PATCH] fix(handler): improve exception reporting to Sentry by honoring application's report policy --- src/Websocket/Handler.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Websocket/Handler.php b/src/Websocket/Handler.php index d483e80..39e81f3 100644 --- a/src/Websocket/Handler.php +++ b/src/Websocket/Handler.php @@ -648,7 +648,15 @@ class Handler implements MessageComponentInterface } try { - if (app()->bound('sentry')) { + // Honour the application's report policy (dontReport + the + // framework's internal don't-report list) so expected + // exceptions thrown by controllers — ValidationException, + // AuthenticationException, etc. — don't flood Sentry from the + // WS bridge the way the HTTP layer already suppresses them. + $handler = app(\Illuminate\Contracts\Debug\ExceptionHandler::class); + $shouldReport = ! method_exists($handler, 'shouldReport') || $handler->shouldReport($e); + + if ($shouldReport && app()->bound('sentry')) { app('sentry')->captureException($e); } } catch (\Throwable $sentryError) {