Skip to content

Commit

Permalink
Fix excluded exceptions option & update SDK dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterHolvoet committed May 27, 2020
1 parent 3a42c10 commit c31d8bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 7 additions & 1 deletion src/Logger/Sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -109,6 +110,7 @@ protected function getClient(): ?ClientInterface
return $this->client;
}

$integrations = [];
$options = new Options([
'dsn' => $this->config->get('dsn'),
'attach_stacktrace' => true,
Expand All @@ -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();
Expand Down

0 comments on commit c31d8bb

Please sign in to comment.