Skip to content

Commit 73de267

Browse files
authored
Handle exceptions raised while resolving the request (#743)
1 parent fd60f0e commit 73de267

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Sentry/Laravel/Http/SetRequestMiddleware.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Http\Request;
99
use Psr\Http\Message\ServerRequestInterface;
1010
use Sentry\State\HubInterface;
11+
use Throwable;
1112

1213
/**
1314
* This middleware caches a PSR-7 version of the request as early as possible.
@@ -34,8 +35,8 @@ private function resolvePsrRequest(Container $container): ?ServerRequestInterfac
3435
{
3536
try {
3637
return $container->make(ServerRequestInterface::class);
37-
} catch (BindingResolutionException $e) {
38-
// This happens if Laravel doesn't have the correct classes available to construct the PSR-7 object
38+
} catch (Throwable $e) {
39+
// Do not crash if there is an exception thrown while resolving the request object
3940
}
4041

4142
return null;

0 commit comments

Comments
 (0)