diff --git a/composer.json b/composer.json index f96cd89..3f3713a 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": ">=7.2.0", "drupal/core": "^8.0 || ^9.0", - "sentry/sentry": "^2.0" + "sentry/sentry": "^2.3" }, "require-dev": { "ergebnis/composer-normalize": "^2.0", diff --git a/src/Logger/Sentry.php b/src/Logger/Sentry.php index 00c6995..cad2bb0 100644 --- a/src/Logger/Sentry.php +++ b/src/Logger/Sentry.php @@ -21,6 +21,7 @@ use Sentry\ClientBuilder; use Sentry\ClientInterface; use Sentry\Event; +use Sentry\Integration\IgnoreErrorsIntegration; use Sentry\Options; use Sentry\Serializer\RepresentationSerializer; use Sentry\Serializer\Serializer; @@ -109,6 +110,7 @@ protected function getClient(): ?ClientInterface return $this->client; } + $integrations = []; $options = new Options([ 'dsn' => $this->config->get('dsn'), 'attach_stacktrace' => true, @@ -125,9 +127,13 @@ protected function getClient(): ?ClientInterface } if ($value = $this->config->get('excluded_exceptions')) { - $options->setExcludedExceptions($value); + $integrations[] = new IgnoreErrorsIntegration([ + 'ignore_exceptions' => $value + ]); } + $options->setIntegrations($integrations); + $this->eventDispatcher->dispatch(WmsentryEvents::OPTIONS_ALTER, new SentryOptionsAlterEvent($options)); return $this->client = (new ClientBuilder($options))->getClient();