[Bug] 3.2.13 The provider is unable to throw a custom exception.
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
### Pre-check
- [X] I am sure that all the content I provide is in English.
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
### Apache Dubbo Component
Java SDK (apache/dubbo)
### Dubbo Version
3.2.13
### Steps to reproduce this issue
Declared a custom interceptor using SPI as follows:
```
@Activate(group = {CommonConstants.PROVIDER})
public class DubboExceptionFilter implements Filter {
@Override
public Result invoke(Invoker invoker, Invocation invocation) throws RpcException {
try {
Result result = invoker.invoke(invocation);
if (result.hasException()) {
Throwable exception = result.getException();
if (exception instanceof BaseException) {
BaseException customException = (BaseException) exception;
return AsyncRpcResult.newDefaultAsyncResult(new BaseException(customException.getMessage(), customException.getCode()), invocation);
}
}
return result;
} catch (RpcException e) {
throw e;
}
}
}
```
However, the exception returned by the caller is still wrapped in a RuntimeException.
### What you expected to happen
Able to correctly retrieve the custom exception.
### Anything else
_No response_
### Are you willing to submit a pull request to fix on your own?
- [ ] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
Research direction
Start by tracing the provider-side Filter.invoke flow in the supplied DubboExceptionFilter example, then inspect how Result, AsyncRpcResult, and RpcException are handled before reaching the caller. Reproduce the SPI interceptor case and verify that a BaseException remains retrievable as the custom exception instead of being wrapped in RuntimeException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100