|
|
@@ -1,6 +1,8 @@
|
|
|
package com.ruoyi.framework.web.exception;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+import com.ruoyi.common.exception.file.FileSizeLimitExceededException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.security.access.AccessDeniedException;
|
|
|
@@ -19,7 +21,7 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
|
/**
|
|
|
* 全局异常处理器
|
|
|
- *
|
|
|
+ *
|
|
|
* @author ruoyi
|
|
|
*/
|
|
|
@RestControllerAdvice
|
|
|
@@ -95,6 +97,17 @@ public class GlobalExceptionHandler
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 上传文件不能超过10M
|
|
|
+ */
|
|
|
+ @ExceptionHandler(FileSizeLimitExceededException.class)
|
|
|
+ public AjaxResult FileSizeLimitExceededException(RuntimeException e, HttpServletRequest request)
|
|
|
+ {
|
|
|
+ String requestURI = request.getRequestURI();
|
|
|
+ log.error("上传文件不能超过10M.", requestURI, e);
|
|
|
+ return AjaxResult.error("上传文件异常,文件大小不能超过10M。");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 系统异常
|
|
|
*/
|
|
|
@ExceptionHandler(Exception.class)
|