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