From 39a72523360cbdaaf6cb9f0b2ad378ddd5d9d1f6 Mon Sep 17 00:00:00 2001 From: zhangtianyu Date: Mon, 18 Apr 2022 18:19:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=A8=E5=B1=80MissingServ?= =?UTF-8?q?letRequestPartException=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oss/client/handler/ControllerExceptionHandler.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oss-client/src/main/java/cn/axzo/oss/client/handler/ControllerExceptionHandler.java b/oss-client/src/main/java/cn/axzo/oss/client/handler/ControllerExceptionHandler.java index bfb854c..9500aea 100644 --- a/oss-client/src/main/java/cn/axzo/oss/client/handler/ControllerExceptionHandler.java +++ b/oss-client/src/main/java/cn/axzo/oss/client/handler/ControllerExceptionHandler.java @@ -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);