提交 83f5627b 编写于 作者: D dqjdda

代码优化

上级 905c8c64
......@@ -80,7 +80,10 @@ public class GlobalExceptionHandler {
// 打印堆栈信息
log.error(ThrowableUtil.getStackTrace(e));
String[] str = Objects.requireNonNull(e.getBindingResult().getAllErrors().get(0).getCodes())[1].split("\\.");
String message = str[1] + ":" + e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
String message = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
if("不能为空".equals(message)){
message = str[1] + ":" + message;
}
return buildResponseEntity(ApiError.error(message));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册