问题描述
我安装了 Symfony 4.3,并将其升级到 4.4.19。
在我的旧安装中,Sentry 与 exclude_exception 运行良好。
我在 sentry.yaml
上这样使用它:
sentry:
dsn: "https://key@sentry.io/id"
options:
excluded_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException
但是当我升级到 4.4.19 时,symfony 日志告诉我 excluded_exceptions
不存在。
Sentry 在我的项目中获取每个异常。它运行良好,所以我不明白为什么它不能识别此选项。 (我已经看到它被添加到 v2.1 的哨兵中)。
我尝试执行 composer update sentry/sentry-symfony
但没有任何变化。
在我的 composer.json 上,我有这个需要部分:
"sentry/sentry": "^3.1","sentry/sentry-symfony": "^4.0",
所以我现在不知道该怎么做才能解决这个问题。也许我一定忘记了什么。
解决方法
请查看 upgrade file 以获取 Sentry Symfony 4.0。
根据这个文件 sentry.options.excluded_exceptions
配置选项被删除。
要排除例外,您必须使用 IgnoreErrorsIntegration
服务:
sentry:
options:
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration'
services:
Sentry\Integration\IgnoreErrorsIntegration:
arguments:
$options:
ignore_exceptions:
- App\Exception\BadArgumentException
- App\Exception\BadFilterException
- App\Exception\BadRequestException