Commit 7d30e603 authored by liaozan's avatar liaozan 🏀

Refine dubbo exception message

parent 71348641
...@@ -37,13 +37,14 @@ public class DubboExceptionFilter extends ExceptionFilter { ...@@ -37,13 +37,14 @@ public class DubboExceptionFilter extends ExceptionFilter {
} }
private void logErrorDetail(Invoker<?> invoker, Throwable exception) { private void logErrorDetail(Invoker<?> invoker, Throwable exception) {
RpcServiceContext context = RpcContext.getServiceContext(); RpcServiceContext context = RpcContext.getCurrentServiceContext();
String arguments = Arrays.toString(context.getArguments()); String arguments = Arrays.toString(context.getArguments());
String serviceName = invoker.getInterface().getSimpleName(); String serviceName = invoker.getInterface().getSimpleName();
String methodName = context.getMethodName(); String methodName = context.getMethodName();
String remoteHost = context.getRemoteHost(); String remoteHost = context.getRemoteHost();
String remoteApplication = context.getRemoteApplicationName(); String remoteApplication = context.getRemoteApplicationName();
log.error("Catch rpc exception, client: {}@{}, target: {}#{}, args: {}", remoteApplication, remoteHost, serviceName, methodName, arguments, exception); String errorMessage = ExceptionUtil.getMessage(exception);
log.error("Catch rpc exception: {}, client: {}@{}, target: {}#{}, args: {}", errorMessage, remoteApplication, remoteHost, serviceName, methodName, arguments, exception);
} }
} }
\ No newline at end of file
...@@ -44,7 +44,7 @@ public class BizIdHelper { ...@@ -44,7 +44,7 @@ public class BizIdHelper {
private static TableFieldInfo getBizIdFieldInfo(TableInfo tableInfo, Field bizIdField) { private static TableFieldInfo getBizIdFieldInfo(TableInfo tableInfo, Field bizIdField) {
List<TableFieldInfo> fieldInfoList = tableInfo.getFieldList().stream() List<TableFieldInfo> fieldInfoList = tableInfo.getFieldList().stream()
.filter(fieldInfo -> fieldInfo.getField() == bizIdField) .filter(fieldInfo -> fieldInfo.getField().equals(bizIdField))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollectionUtils.isEmpty(fieldInfoList)) { if (CollectionUtils.isEmpty(fieldInfoList)) {
throw new BaseException(String.format("%s can not be found in fieldList", bizIdField.getName())); throw new BaseException(String.format("%s can not be found in fieldList", bizIdField.getName()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment