Commit e71ed06b by 章家宝

feat:参数错误提示

1 parent 94ce2224
......@@ -6,10 +6,10 @@ import lombok.extern.slf4j.Slf4j;
import org.hibernate.HibernateException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.*;
import org.summerframework.core.enums.ErrorCodeEnum;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.summerframework.core.exception.BusinessCodeException;
import org.summerframework.core.exception.BusinessException;
import java.util.stream.Collectors;
......@@ -40,7 +40,7 @@ public class GlobalExceptionHandler {
String errorMsg = e.getBindingResult().getFieldErrors().stream()
.map(fieldError -> fieldError.getField() + ":" + fieldError.getDefaultMessage())
.collect(Collectors.joining(","));
return BaseResp.fail("参数错误:" + errorMsg);
return BaseResp.fail(errorMsg);
}
// 捕获所有未指定的异常(兜底)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!