mirror of https://github.com/halo-dev/halo
Update exception throw logic
parent
ccdb705e7e
commit
95b3e944f0
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue