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

[feature] modified sentinel-dubbo-adapter module DefaultDubboFallback… #1756

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.alibaba.csp.sentinel.adapter.dubbo.fallback;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Result;
Expand All @@ -29,7 +28,9 @@ public class DefaultDubboFallback implements DubboFallback {

@Override
public Result handle(Invoker<?> invoker, Invocation invocation, BlockException ex) {
// Just wrap the exception.
return new RpcResult(new SentinelRpcException(ex));
// Just wrap the exception. edit by wzg923 2020/9/23
RpcResult result = new RpcResult();
result.setException(ex.toRuntimeException());
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testDefaultFallback() {
BlockException ex = new FlowException("xxx");
Result result = new DefaultDubboFallback().handle(null, null, ex);
Assert.assertTrue(result.hasException());
Assert.assertEquals(SentinelRpcException.class, result.getException().getClass());
Assert.assertEquals(RuntimeException.class, result.getException().getClass());
}

@Test
Expand Down