|
@@ -12,6 +12,7 @@ import org.springframework.validation.BindException;
|
|
import org.springframework.validation.FieldError;
|
|
import org.springframework.validation.FieldError;
|
|
import org.springframework.validation.ObjectError;
|
|
import org.springframework.validation.ObjectError;
|
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
|
|
|
+import org.springframework.web.bind.MissingServletRequestParameterException;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
|
@@ -50,6 +51,11 @@ public class FSExceptionHandler {
|
|
return R.error("数据库中已存在该记录");
|
|
return R.error("数据库中已存在该记录");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ExceptionHandler(MissingServletRequestParameterException.class)
|
|
|
|
+ public R handleMissingServletRequestParameterException(MissingServletRequestParameterException e) {
|
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
|
+ return R.error("缺少必要的参数");
|
|
|
|
+ }
|
|
|
|
|
|
@ExceptionHandler(Exception.class)
|
|
@ExceptionHandler(Exception.class)
|
|
public R handleException(Exception e){
|
|
public R handleException(Exception e){
|