后端验证提示信息优化

This commit is contained in:
thinkgem
2024-04-21 19:53:27 +08:00
parent 657f22da98
commit 05641a271e

View File

@@ -9,7 +9,8 @@ if (isBlank(message)){
if (ex != null){
if(@StringUtils.startsWith(@ex.getMessage(), 'msg:')){
message = @StringUtils.replace(@ex.getMessage(), 'msg:', '');
}else if (type.fullName(ex) == 'org.springframework.validation.BindException'){
}else if (type.fullName(ex) == 'org.springframework.validation.BindException'
|| type.fullName(ex) == 'org.springframework.web.bind.MethodArgumentNotValidException'){
for (var e in ex.globalErrors){
message = message + '☆ ' + text(e.defaultMessage) + ' (' + e.objectName + ')<br/>';
}