refactor: exception message when theme installation failed (#3826)

#### What type of PR is this?
/kind improvement
/area core
/milestone 2.5.x

#### What this PR does / why we need it:
优化由于缺少资源文件而安装失败时的异常提示信息
<img width="689" alt="image" src="https://user-images.githubusercontent.com/38999863/233826417-355a6899-578f-4d0b-a9ab-7664e4cd1bf7.png">
#### Which issue(s) this PR fixes:
Fixes #3825

#### Does this PR introduce a user-facing change?
```release-note
None
```
pull/3845/head
guqing 2023-04-24 17:19:33 +08:00 committed by GitHub
parent fc77d51c48
commit ce60aab9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -149,8 +149,8 @@ class ThemeUtils {
new YamlUnstructuredLoader(new FileSystemResource(themeManifestPath))
.load();
if (CollectionUtils.isEmpty(unstructureds)) {
throw new IllegalArgumentException(
"The [theme.yaml] does not conform to the theme specification.");
throw new ThemeInstallationException("Missing theme manifest",
"problemDetail.theme.install.missingManifest", null);
}
return unstructureds.get(0);
}

View File

@ -39,7 +39,7 @@ problemDetail.comment.turnedOff=The comment function has been turned off.
problemDetail.comment.systemUsersOnly=Allow only system users to comment
problemDetail.theme.upgrade.missingManifest=Missing theme manifest file "theme.yaml" or "theme.yml".
problemDetail.theme.upgrade.nameMismatch=The current theme name {0} did not match the installed theme name.
problemDetail.theme.install.missingManifest=Missing theme manifest file "theme.yaml" or "theme.yml".
problemDetail.theme.install.missingManifest=Missing theme manifest file "theme.yaml" or manifest file does not conform to the theme specification.
problemDetail.theme.install.alreadyExists=Theme {0} already exists.
problemDetail.theme.version.unsatisfied.requires=The theme requires a minimum system version of {0}, but the current version is {1}.
problemDetail.directoryTraversal=Directory traversal detected. Base path is {0}, but real path is {1}.

View File

@ -4,6 +4,7 @@ problemDetail.title.run.halo.app.infra.exception.PluginInstallationException=插
problemDetail.title.run.halo.app.infra.exception.AttachmentAlreadyExistsException=附件已存在
problemDetail.title.run.halo.app.infra.exception.DuplicateNameException=名称重复
problemDetail.title.run.halo.app.infra.exception.PluginAlreadyExistsException=插件已存在
problemDetail.title.run.halo.app.infra.exception.ThemeInstallationException=主题安装失败
problemDetail.run.halo.app.infra.exception.AttachmentAlreadyExistsException=文件 {0} 已存在,建议更名后重试。
problemDetail.run.halo.app.infra.exception.DuplicateNameException=检测到有重复的名称,请重命名后重试。
@ -14,4 +15,5 @@ problemDetail.user.duplicateName=用户名 {0} 已存在,请更换用户名后
problemDetail.plugin.version.unsatisfied.requires=插件要求一个最小的系统版本为 {0}, 但当前版本为 {1}。
problemDetail.theme.version.unsatisfied.requires=主题要求一个最小的系统版本为 {0}, 但当前版本为 {1}。
problemDetail.theme.version.unsatisfied.requires=主题要求一个最小的系统版本为 {0}, 但当前版本为 {1}。
problemDetail.theme.install.missingManifest=缺少 theme.yaml 配置文件或配置文件不符合规范。