Issue
The Sentry SDK is not captuting HTTP exceptions (404, 403 response codes) raised in my Laravel app. (This article is using Laravel Framework 11)
Applies To
- All SaaS Sentry Customers and Self-Hosted Users
- Laravel Framework
Resolution
Laravel typically handles HTTP exceptions internally, as a result, these exceptions do not reach our SDK integration in your exception handlers (source).
To solve it, use "stopIgnoring" in your Laravel exception handler to stop the framework from ignoring them. For example:
->withExceptions(function (Exceptions $exceptions) {
$exceptions->stopIgnoring(HttpException::class);
Integration::handles($exceptions);
})->create();