Update exception throw logic

pull/389/head
johnniang 2019-11-17 21:07:49 +08:00
parent ccdb705e7e
commit 95b3e944f0
1 changed files with 38 additions and 39 deletions

View File

@ -335,7 +335,10 @@ public class AdminServiceImpl implements AdminService {
Object assetsObject = responseEntity.getBody().get("assets");
if (assetsObject instanceof List) {
if (!(assetsObject instanceof List)) {
throw new ServiceException("Github API 返回内容有误").setErrorData(assetsObject);
}
try {
List assets = (List) assetsObject;
Map assetMap = (Map) assets.stream()
@ -370,11 +373,7 @@ public class AdminServiceImpl implements AdminService {
// Copy it to template/admin folder
FileUtils.copyFolder(FileUtils.tryToSkipZipParentFolder(assetTempPath), adminPath);
} catch (Throwable t) {
log.error("Failed to update halo admin", t);
throw new ServiceException("更新 Halo admin 失败");
}
} else {
throw new ServiceException("Github API 返回内容有误").setErrorData(assetsObject);
throw new ServiceException("更新 Halo admin 失败", t);
}
}