增加全局MissingServletRequestPartException处理
This commit is contained in:
parent
9088cc94f3
commit
39a7252336
@ -13,6 +13,7 @@ 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.RestControllerAdvice;
|
||||
import org.springframework.web.multipart.support.MissingServletRequestPartException;
|
||||
|
||||
/**
|
||||
* @program: oss
|
||||
@ -30,6 +31,12 @@ public class ControllerExceptionHandler {
|
||||
return CommonResponse.error(CodeEnum.MISSING_REQUEST_PARAM.getCode(), e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = MissingServletRequestPartException.class)
|
||||
public CommonResponse handleMissingRequestPart(MissingServletRequestPartException e) {
|
||||
log.warn("[oss] ControllerExceptionHandler.missing servlet request part Exception", e);
|
||||
return CommonResponse.error(CodeEnum.MISSING_REQUEST_PARAM.getCode(), e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = BizException.class)
|
||||
public CommonResponse bizException(BizException e){
|
||||
log.warn("[oss] ControllerExceptionHandler.bizException Exception", e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user