You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static final String BLOCK_EXCEPTION_FLAG = "SentinelBlockException";
public static RuntimeException THROW_OUT_EXCEPTION = new RuntimeException(BLOCK_EXCEPTION_FLAG);
...
if ((cause instanceof BlockException) || (BLOCK_EXCEPTION_FLAG.equals(cause.getMessage()))) {
...
Issue Description
1.通过sentinel-dubbo-adapter埋点抛出了
SentinelRpcException
,Dubbo框架经过com.alibaba.dubbo.common.utils.StringUtils.toString(SentinelRpcException)
处理后抛出了RpcException
或RuntimeException
,这时在调用方捕获到RpcException
或RuntimeException
,用BlockException#isBlockException判断是false,Dubbo通过这个工具类处理是为了避免调用方法反序列化失败,但实际上发生了流控,能否考虑通过判断message的方式返回true呢?2.
BlockException
类有如下定义和判断:在工程中搜索,这个
THROW_OUT_EXCEPTION
并没有用到,也就是判断里不会走到后面那个或分支,为什么用这个cause.getMessage()和"SentinelBlockException"判断? 要不要把SentinelRpcException、BlockException、FlowException也加上Describe what happened (or what feature you want)
测试代码:
Describe what you expected to happen
期望如果Message中有SentinelRpcException、FlowException、DegradeException、BlockException等,
BlockException#isBlockException
能返回true,这样便于dubbo在捕获异常,区分是Sentinel的流控异常;但这样通过message判断是否合理,有没有更好的方式。
#374 在dubbo-demo的例子里也有此需求
The text was updated successfully, but these errors were encountered: