mirror of https://github.com/jeecgboot/jeecg-boot
parent
e364b950ca
commit
7bdc1b06d3
|
@ -239,6 +239,11 @@
|
|||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
<!-- 解决okhttp引用了kotlin,应用启动有警告日志问题 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-kotlin</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -4,6 +4,7 @@ import io.lettuce.core.RedisConnectionException;
|
|||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.data.redis.connection.PoolException;
|
||||
|
@ -26,7 +27,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class JeecgBootExceptionHandler {
|
||||
|
||||
@Value("${spring.servlet.multipart.max-file-size}")
|
||||
private String maxFileSize;
|
||||
/**
|
||||
* 处理自定义异常
|
||||
*/
|
||||
|
@ -100,7 +102,7 @@ public class JeecgBootExceptionHandler {
|
|||
@ExceptionHandler(MaxUploadSizeExceededException.class)
|
||||
public Result<?> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! ");
|
||||
return Result.error(String.format("文件大小超出%s限制, 请压缩或降低文件质量! ", maxFileSize));
|
||||
}
|
||||
|
||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||
|
|
Loading…
Reference in New Issue