pref: throw file deletion failure exception. (#1430)

* 又拍云文件删除失败无响应的问题修复

* Update QiniuOssFileHandler.java

* Update LocalFileHandler.java

* Update LocalFileHandler.java

* Update QiniuOssFileHandler.java

* Update UpOssFileHandler.java
pull/1488/head
低调小熊猫 2021-07-19 20:57:58 +08:00 committed by GitHub
parent b6527823e4
commit f42d4e2dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View File

@ -194,6 +194,7 @@ public class LocalFileHandler implements FileHandler {
boolean deleteResult = Files.deleteIfExists(thumbnailPath);
if (!deleteResult) {
log.warn("Thumbnail: [{}] may not exist", thumbnailPath.toString());
throw new FileOperationException("附件缩略图 " + thumbnailName + " 删除失败");
}
} catch (IOException e) {
throw new FileOperationException("附件缩略图 " + thumbnailName + " 删除失败", e);

View File

@ -185,6 +185,7 @@ public class QiniuOssFileHandler implements FileHandler {
Response response = bucketManager.delete(bucket, key);
if (!response.isOK()) {
log.warn("附件 " + key + " 从七牛云删除失败");
throw new FileOperationException("附件 " + key + " 从七牛云删除失败");
}
} catch (QiniuException e) {
log.error("Qiniu oss error response: [{}]", e.response);

View File

@ -132,6 +132,7 @@ public class UpOssFileHandler implements FileHandler {
Response result = manager.deleteFile(key, null);
if (!result.isSuccessful()) {
log.warn("附件 " + key + " 从又拍云删除失败");
throw new FileOperationException("附件 " + key + " 从又拍云删除失败");
}
} catch (IOException | UpException e) {
e.printStackTrace();