参数校验
This commit is contained in:
@ -47,10 +47,11 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public BaseResponse<?> handleHttpMessageNotReadableException(HttpMessageNotReadableException e) {
|
||||
log.error("HttpMessageNotReadableException", e);
|
||||
return ResultUtils.error(ErrorCode.PARAMS_ERROR, e.getMessage());
|
||||
return ResultUtils.error(ErrorCode.PARAMS_ERROR, "请求体不能为空或格式无效");
|
||||
}
|
||||
|
||||
|
||||
// 处理业务异常
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public BaseResponse<?> businessExceptionHandler(BusinessException e) {
|
||||
log.error("BusinessException", e);
|
||||
@ -58,6 +59,7 @@ public class GlobalExceptionHandler {
|
||||
}
|
||||
|
||||
|
||||
// 处理运行时异常
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public BaseResponse<?> runtimeExceptionHandler(RuntimeException e) {
|
||||
log.error("RuntimeException", e);
|
||||
|
Reference in New Issue
Block a user