Skip to content

Commit 1d2b7a7

Browse files
committed
Only catch BindingResolutionException when trying to get the PSR-7 request object from the container
1 parent 041a9df commit 1d2b7a7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Only catch `BindingResolutionException` when trying to get the PSR-7 request object from the container
6+
57
## 2.12.1
68

79
- Fix incorrect `release` and `environment` values when using the `sentry:test` command

src/Sentry/Laravel/Http/SetRequestMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
use Closure;
66
use Illuminate\Container\Container;
7+
use Illuminate\Contracts\Container\BindingResolutionException;
78
use Illuminate\Http\Request;
89
use Psr\Http\Message\ServerRequestInterface;
910
use Sentry\State\HubInterface;
10-
use Throwable;
1111

1212
/**
1313
* This middleware caches a PSR-7 version of the request as early as possible.
@@ -33,7 +33,7 @@ public function handle(Request $request, Closure $next)
3333
LaravelRequestFetcher::CONTAINER_PSR7_INSTANCE_KEY,
3434
$container->make(ServerRequestInterface::class)
3535
);
36-
} catch (Throwable $e) {
36+
} catch (BindingResolutionException $e) {
3737
// Ignore problems getting the PSR-7 server request instance here
3838
// In the Laravel request fetcher we have other fallbacks for that
3939
}

0 commit comments

Comments
 (0)