-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from getsentry/rework-to-use-only-listeners
Rework to use only listeners
- Loading branch information
Showing
12 changed files
with
181 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Sentry\SentryBundle\DependencyInjection; | ||
|
||
use Sentry\ClientBuilderInterface; | ||
use Sentry\Integration\ErrorListenerIntegration; | ||
use Sentry\Integration\ExceptionListenerIntegration; | ||
use Sentry\Integration\IntegrationInterface; | ||
use Sentry\SentryBundle\SentryBundle; | ||
|
||
class ClientBuilderConfigurator | ||
{ | ||
public static function configure(ClientBuilderInterface $clientBuilder): void | ||
{ | ||
$clientBuilder->setSdkIdentifier(SentryBundle::SDK_IDENTIFIER); | ||
$clientBuilder->setSdkVersion(SentryBundle::getSdkVersion()); | ||
|
||
$options = $clientBuilder->getOptions(); | ||
if (! $options->hasDefaultIntegrations()) { | ||
return; | ||
} | ||
|
||
$integrations = $options->getIntegrations(); | ||
$options->setIntegrations(array_filter($integrations, static function (IntegrationInterface $integration): bool { | ||
if ($integration instanceof ErrorListenerIntegration) { | ||
return false; | ||
} | ||
|
||
if ($integration instanceof ExceptionListenerIntegration) { | ||
return false; | ||
} | ||
|
||
return true; | ||
})); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Sentry\SentryBundle\EventListener; | ||
|
||
use Symfony\Component\Console\Event\ConsoleErrorEvent; | ||
use Symfony\Component\Console\Event\ConsoleExceptionEvent; | ||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | ||
|
||
final class ErrorListener | ||
{ | ||
public function onKernelException(GetResponseForExceptionEvent $event): void | ||
{ | ||
\Sentry\captureException($event->getException()); | ||
} | ||
|
||
public function onConsoleError(ConsoleErrorEvent $event): void | ||
{ | ||
\Sentry\captureException($event->getError()); | ||
} | ||
|
||
/** | ||
* BC layer for Symfony < 3.3; see https://symfony.com/blog/new-in-symfony-3-3-better-handling-of-command-exceptions | ||
*/ | ||
public function onConsoleException(ConsoleExceptionEvent $event): void | ||
{ | ||
\Sentry\captureException($event->getException()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters