一个基于Spring启动的Web服务正在使用Sentry,如docs中所述。它工作正常,但有些异常不应发送到Sentry,例如,在某些请求上为了返回HTTP状态410
而抛出的异常:
// Kotlin code, but in Java it would be similar.
@ResponseStatus(value = HttpStatus.GONE)
class GoneException(msg: String) : RuntimeException(msg) {
}
我如何告诉我的sentryExceptionResolver
跳过这些异常?
2条答案
按热度按时间xt0899hw1#
在python中很简单,你只需在配置文件中添加下面的代码来忽略多个异常
但是在java中我在
sentry.properties
中找不到类似的标签,你自己试试也许你会找到。或者您可以在Configuration类中添加
HandlerExceptionResolver
,然后手动覆盖resolveException
方法并忽略异常。1l5u6lss2#
您可以设置;
https://docs.sentry.io/platforms/java/configuration/