Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servicecomb提供的异常拦截器ExceptionToProducerResponseConverter不能拦截 Handler,HttpServerFilter 等抛出的异常 #4634

Open
JedrekWang opened this issue Dec 5, 2024 · 4 comments
Labels

Comments

@JedrekWang
Copy link

JedrekWang commented Dec 5, 2024

背景

当业务定制的filter或者servicecomb自带的filter出现异常时,想要根据对应的异常类型或异常信息来记录日志或告警

分析

查看servicecomb源码,发现ExceptionToProducerResponseConverter只能在业务执行业务逻辑阶段抛出异常才会捕获, Handler,HttpServerFilter 等抛出的异常当前没有通用的拦截机制

诉求

能够针对Handler,HttpServerFilter 等抛出的异常也提供类似异常捕获器的能力

@liubao68
Copy link
Contributor

liubao68 commented Dec 5, 2024

2.x目前这个异常处理就是不包括Handler和HttpServerFilter异常的。 如果你有特殊情况, 可以考虑增加异常处理的Handler或者HttpServerFilter, 也可以考虑不要在这些地方抛出异常,而是处理掉异常。

@JedrekWang
Copy link
Author

业务自己扩展的handler和filter可以通过内部异常捕获来处理,但是servicecomb自带的handler和HttpServerFilter没办法去定制捕获异常的逻辑

@liubao68
Copy link
Contributor

你能提供下servicecomb自带的handler和HttpServerFilter抛出的具体异常吗? 看下是什么场景。

@JedrekWang
Copy link
Author

比如说,ServerRestArgsFilter这个filter在校验接口入参的时候抛的异常信息,Parameter is not valid for operation [%s]. Parameter is [%s]. Processor is [%s]. Message is [%s].
业务想要对接口入参类型的异常进行告警

@liubao68 liubao68 added the 2.x label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants