Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
better
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyitao committed Dec 17, 2020
1 parent f1bbf17 commit 59ca858
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.daxiang</groupId>
<artifactId>server</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>jar</packaging>

<properties>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/daxiang/service/PageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -66,6 +67,9 @@ public void add(Page page) {
if (!StringUtils.isEmpty(destImgPath)) {
try {
fileService.moveFile(originalImgPath, destImgPath);
} catch (FileNotFoundException e) {
log.info("file not found: {}", originalImgPath);
throw new ServerException("图片不存在,该图片可能已保存至其他Page");
} catch (IOException e) {
log.error("move {} -> {} err", originalImgPath, destImgPath, e);
throw new ServerException(e.getMessage());
Expand Down

0 comments on commit 59ca858

Please sign in to comment.