Issue
The Sentry SDK is not capturing HTTP exceptions (404, 403 response codes) raised in my Laravel app. What could be going wrong?
Applies To
- All SaaS Customers and Self-Hosted Users
- Laravel Framework 11
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();