mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-03-03 12:31:04 -08:00
feat: handle revert error
This commit is contained in:
parent
76b0cc2f6b
commit
df1c19ad1f
4 changed files with 24 additions and 8 deletions
|
|
@ -249,8 +249,10 @@
|
|||
"OpenMetaDataFolderDetail": "TiddlyWiki's data and TiddlyGit's workspace metadata are stored separately. TiddlyGit's metadata includes workspace settings, etc., which are stored in this folder in JSON format."
|
||||
},
|
||||
"Error": {
|
||||
"InitWikiGitError": "Note warehouse initialization failed error",
|
||||
"InitWikiGitErrorDescription": "The template used by the new note repository failed to copy or the git initialization of the note repository failed. This should be a bug."
|
||||
"InitWikiGitError": "InitWikiGitError",
|
||||
"InitWikiGitErrorDescription": "The template used by the new note repository failed to copy or the git initialization of the note repository failed. This should be a bug.",
|
||||
"InitWikiGitRevertError": "InitWikiGitRevertError",
|
||||
"InitWikiGitRevertErrorDescription": "Not only did the initialization of the note warehouse fail, but also the revocation failed. This is a serious problem, and you need to manually clean up the new folder generated in this location."
|
||||
},
|
||||
"Loading": "Loading",
|
||||
"Yes": "Yes",
|
||||
|
|
|
|||
|
|
@ -251,7 +251,9 @@
|
|||
},
|
||||
"Error": {
|
||||
"InitWikiGitError": "笔记仓库初始化失败错误",
|
||||
"InitWikiGitErrorDescription": "新笔记仓库所用的模板复制失败或者笔记仓库的git初始化失败,这应该是个bug。"
|
||||
"InitWikiGitErrorDescription": "新笔记仓库所用的模板复制失败或者笔记仓库的git初始化失败,这应该是个bug。",
|
||||
"InitWikiGitRevertError": "笔记仓库初始化失败且撤销失败错误",
|
||||
"InitWikiGitRevertErrorDescription": "不仅笔记仓库初始化失败了,而且撤销也失败了,这是个严重问题,需要你手动清理该位置生成的新文件夹。"
|
||||
},
|
||||
"Loading": "加载中",
|
||||
"Yes": "是的",
|
||||
|
|
|
|||
|
|
@ -7,3 +7,11 @@ export class InitWikiGitError extends Error {
|
|||
this.message = `${i18n.t('Error.InitWikiGitErrorDescription')} ${extraMessage ?? ''}`;
|
||||
}
|
||||
}
|
||||
|
||||
export class InitWikiGitRevertError extends Error {
|
||||
constructor(extraMessage?: string) {
|
||||
super(extraMessage);
|
||||
this.name = i18n.t('Error.InitWikiGitRevertError');
|
||||
this.message = `${i18n.t('Error.InitWikiGitRevertErrorDescription')} ${extraMessage ?? ''}`;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { logger } from '@services/libs/log';
|
|||
import i18n from '@services/libs/i18n';
|
||||
import { IWikiGitWorkspaceService } from './interface';
|
||||
import { IMenuService } from '@services/menu/interface';
|
||||
import { InitWikiGitError } from './error';
|
||||
import { InitWikiGitError, InitWikiGitRevertError } from './error';
|
||||
|
||||
@injectable()
|
||||
export class WikiGitWorkspace implements IWikiGitWorkspaceService {
|
||||
|
|
@ -50,10 +50,14 @@ export class WikiGitWorkspace implements IWikiGitWorkspaceService {
|
|||
}
|
||||
} catch (error) {
|
||||
logger.info(error);
|
||||
if (isMainWiki) {
|
||||
await this.wikiService.removeWiki(wikiFolderPath);
|
||||
} else {
|
||||
await this.wikiService.removeWiki(wikiFolderPath, isSyncedWiki ? mainWikiToUnLink : githubRepoUrlOrMainWikiToUnLinkOverload);
|
||||
try {
|
||||
if (isMainWiki) {
|
||||
await this.wikiService.removeWiki(wikiFolderPath);
|
||||
} else {
|
||||
await this.wikiService.removeWiki(wikiFolderPath, isSyncedWiki ? mainWikiToUnLink : githubRepoUrlOrMainWikiToUnLinkOverload);
|
||||
}
|
||||
} catch (error_) {
|
||||
throw new InitWikiGitRevertError((error_ as Error).message);
|
||||
}
|
||||
throw new InitWikiGitError((error as Error).message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue