mirror of https://github.com/halo-dev/halo
pref: throw file deletion failure exception. (#1430)
* 又拍云文件删除失败无响应的问题修复 * Update QiniuOssFileHandler.java * Update LocalFileHandler.java * Update LocalFileHandler.java * Update QiniuOssFileHandler.java * Update UpOssFileHandler.javapull/1488/head
parent
b6527823e4
commit
f42d4e2dae
|
@ -194,6 +194,7 @@ public class LocalFileHandler implements FileHandler {
|
||||||
boolean deleteResult = Files.deleteIfExists(thumbnailPath);
|
boolean deleteResult = Files.deleteIfExists(thumbnailPath);
|
||||||
if (!deleteResult) {
|
if (!deleteResult) {
|
||||||
log.warn("Thumbnail: [{}] may not exist", thumbnailPath.toString());
|
log.warn("Thumbnail: [{}] may not exist", thumbnailPath.toString());
|
||||||
|
throw new FileOperationException("附件缩略图 " + thumbnailName + " 删除失败");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new FileOperationException("附件缩略图 " + thumbnailName + " 删除失败", e);
|
throw new FileOperationException("附件缩略图 " + thumbnailName + " 删除失败", e);
|
||||||
|
|
|
@ -185,6 +185,7 @@ public class QiniuOssFileHandler implements FileHandler {
|
||||||
Response response = bucketManager.delete(bucket, key);
|
Response response = bucketManager.delete(bucket, key);
|
||||||
if (!response.isOK()) {
|
if (!response.isOK()) {
|
||||||
log.warn("附件 " + key + " 从七牛云删除失败");
|
log.warn("附件 " + key + " 从七牛云删除失败");
|
||||||
|
throw new FileOperationException("附件 " + key + " 从七牛云删除失败");
|
||||||
}
|
}
|
||||||
} catch (QiniuException e) {
|
} catch (QiniuException e) {
|
||||||
log.error("Qiniu oss error response: [{}]", e.response);
|
log.error("Qiniu oss error response: [{}]", e.response);
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class UpOssFileHandler implements FileHandler {
|
||||||
Response result = manager.deleteFile(key, null);
|
Response result = manager.deleteFile(key, null);
|
||||||
if (!result.isSuccessful()) {
|
if (!result.isSuccessful()) {
|
||||||
log.warn("附件 " + key + " 从又拍云删除失败");
|
log.warn("附件 " + key + " 从又拍云删除失败");
|
||||||
|
throw new FileOperationException("附件 " + key + " 从又拍云删除失败");
|
||||||
}
|
}
|
||||||
} catch (IOException | UpException e) {
|
} catch (IOException | UpException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue