File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
src/Sentry/SentryBundle/EventListener Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -90,10 +90,9 @@ public function onKernelRequest(GetResponseEvent $event)
9090 public function onKernelException (GetResponseForExceptionEvent $ event )
9191 {
9292 $ exception = $ event ->getException ();
93- foreach ($ this ->skipCapture as $ className ) {
94- if ($ exception instanceof $ className ) {
95- return ;
96- }
93+
94+ if ($ this ->shouldExceptionCaptureBeSkipped ($ exception )) {
95+ return ;
9796 }
9897
9998 $ this ->client ->captureException ($ exception );
@@ -106,6 +105,10 @@ public function onConsoleException(ConsoleExceptionEvent $event)
106105 {
107106 $ command = $ event ->getCommand ();
108107 $ exception = $ event ->getException ();
108+
109+ if ($ this ->shouldExceptionCaptureBeSkipped ($ exception )) {
110+ return ;
111+ }
109112
110113 $ data = array (
111114 'tags ' => array (
@@ -116,6 +119,18 @@ public function onConsoleException(ConsoleExceptionEvent $event)
116119
117120 $ this ->client ->captureException ($ exception , $ data );
118121 }
122+
123+ private function shouldExceptionCaptureBeSkipped (\Exception $ exception )
124+ {
125+ foreach ($ this ->skipCapture as $ className ) {
126+ if ($ exception instanceof $ className ) {
127+ return true ;
128+ }
129+ }
130+
131+ return false ;
132+ }
133+
119134
120135 /**
121136 * @param UserInterface | object | string $user
You can’t perform that action at this time.
0 commit comments