feng996 opened a new issue #9310:
URL: https://github.com/apache/dubbo/issues/9310
dubbo.version=3.0.4
dubbo.protocol=tri
provider throw的所有异常在consumer端都会被包装为RpcException。
怎么能在consumer端重放provider发生的异常呢
这里是UnaryClientStream$UnaryClientTransportObserver#getThrowable
```
private Throwable getThrowable(Metadata metadata) {
if (null == metadata) {
return null;
}
// second get status detail
if
(!metadata.contains(TripleHeaderEnum.STATUS_DETAIL_KEY.getHeader())) {
return null;
}
final CharSequence raw =
metadata.get(TripleHeaderEnum.STATUS_DETAIL_KEY.getHeader());
byte[] statusDetailBin = TripleUtil.decodeASCIIByte(raw);
ClassLoader tccl =
Thread.currentThread().getContextClassLoader();
try {
final Status statusDetail =
TripleUtil.unpack(statusDetailBin, Status.class);
List<Any> detailList = statusDetail.getDetailsList();
Map<Class<?>, Object> classObjectMap =
TripleUtil.tranFromStatusDetails(detailList);
// get common exception from DebugInfo
DebugInfo debugInfo = (DebugInfo)
classObjectMap.get(DebugInfo.class);
if (debugInfo == null) {
return new RpcException(statusDetail.getCode(),
statusDetail.getMessage());
}
String msg =
ExceptionUtils.getStackFrameString(debugInfo.getStackEntriesList());
return new RpcException(statusDetail.getCode(), msg);
} finally {
ClassLoadUtil.switchContextLoader(tccl);
}
}
```
consumer处理异常时都会被包装为RpcException
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]