File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use Sentry \State \HubInterface ;
8
8
use Symfony \Component \HttpKernel \Event \ExceptionEvent ;
9
+ use Symfony \Component \Messenger \Exception \HandlerFailedException ;
9
10
10
11
/**
11
12
* This listener listens for error events and logs them to Sentry.
@@ -36,9 +37,17 @@ public function handleExceptionEvent(ErrorListenerExceptionEvent $event): void
36
37
{
37
38
/** @psalm-suppress RedundantCondition */
38
39
if ($ event instanceof ExceptionEvent) {
39
- $ this -> hub -> captureException ( $ event ->getThrowable () );
40
+ $ error = $ event ->getThrowable ();
40
41
} else {
41
- $ this ->hub ->captureException ($ event ->getException ());
42
+ $ error = $ event ->getException ();
43
+ }
44
+
45
+ if ($ error instanceof HandlerFailedException) {
46
+ foreach ($ error ->getNestedExceptions () as $ nestedException ) {
47
+ $ this ->hub ->captureException ($ nestedException );
48
+ }
49
+ } else {
50
+ $ this ->hub ->captureException ($ error );
42
51
}
43
52
}
44
53
}
You can’t perform that action at this time.
0 commit comments