|
|
|
@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
|
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 统一异常处理器配置
|
|
|
|
@ -39,4 +40,12 @@ public class ExceptionHandlerConfig {
|
|
|
|
|
log.error("<<<=========运行异常=========");
|
|
|
|
|
return R.fail(ResultStatusEnum.RUNTIME_EXCEPTION,exception.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ExceptionHandler(MaxUploadSizeExceededException.class)
|
|
|
|
|
public R<?> handleMaxSizeException(MaxUploadSizeExceededException exception) {
|
|
|
|
|
log.error("=========文件大小超出限制异常=========>>>");
|
|
|
|
|
log.error(exception.getMessage(), exception);
|
|
|
|
|
log.error("<<<=========文件大小超出限制异常=========");
|
|
|
|
|
return R.fail(ResultStatusEnum.EXCEED_FILE_SIZE,exception.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|