Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude exceptions from Sentry in Symfony?

I have an installation of Symfony 4.3 and I upgrade it to 4.4.19. On my old installation Sentry was working well with excluded_exception. I use it like this on sentry.yaml :

sentry:
    dsn: "https://[email protected]/id"
    options:
        excluded_exceptions:
            - App\Exception\BadArgumentException
            - App\Exception\BadFilterException
            - App\Exception\BadRequestException

But when I upgrade to 4.4.19 symfony logs tells me that excluded_exceptions does not exist. Sentry get each exception on my project. It works well so I don't understand why it doesn't recognize this option. (I've seen that it was add to sentry on v2.1).

I've tried to do a composer update sentry/sentry-symfony but nothing changes. On my composer.json I have this on require part : "sentry/sentry": "^3.1", "sentry/sentry-symfony": "^4.0",

So I don't know what to do now to fix this problem. I must forgot something maybe.

like image 380
Develogg Avatar asked Dec 04 '22 17:12

Develogg


1 Answers

Please check upgrade file for Sentry Symfony 4.0.

According to this file sentry.options.excluded_exceptions configuration option was removed. To exclude exceptions you must use IgnoreErrorsIntegration service:

sentry:
  options:
    integrations:
      - 'Sentry\Integration\IgnoreErrorsIntegration'

services:
  Sentry\Integration\IgnoreErrorsIntegration:
    arguments:
      $options:
        ignore_exceptions:
          - App\Exception\BadArgumentException
          - App\Exception\BadFilterException
          - App\Exception\BadRequestException
like image 152
greeflas Avatar answered Dec 15 '22 22:12

greeflas