mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-25 05:51:04 -08:00
docs: better error message when failed loading
This commit is contained in:
parent
df353131aa
commit
7bfdae7940
4 changed files with 18 additions and 4 deletions
9
src/services/workspacesView/error.ts
Normal file
9
src/services/workspacesView/error.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import i18n from '@services/libs/i18n';
|
||||
|
||||
export class WorkspaceFailedToLoadError extends Error {
|
||||
constructor(extraMessage?: string, url?: string) {
|
||||
super(extraMessage);
|
||||
this.name = i18n.t('Error.WorkspaceFailedToLoadError');
|
||||
this.message = `${i18n.t('Error.WorkspaceFailedToLoadErrorDescription')} ${extraMessage ?? ''} ${url ?? ''}`;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ import { IWikiService } from '@services/wiki/interface';
|
|||
import { IWorkspaceViewService } from './interface';
|
||||
import { lazyInject } from '@services/container';
|
||||
import { SupportedStorageServices } from '@services/types';
|
||||
import { WorkspaceFailedToLoadError } from './error';
|
||||
|
||||
@injectable()
|
||||
export class WorkspaceView implements IWorkspaceViewService {
|
||||
|
|
@ -62,7 +63,7 @@ export class WorkspaceView implements IWorkspaceViewService {
|
|||
}
|
||||
await this.viewService.addView(mainWindow, workspace);
|
||||
const userInfo = await this.authService.getStorageServiceUserInfo(workspace.storageService);
|
||||
const { wikiFolderLocation, gitUrl: githubRepoUrl, storageService } = workspace;
|
||||
const { wikiFolderLocation, gitUrl: githubRepoUrl, storageService, homeUrl } = workspace;
|
||||
// wait for main wiki's watch-fs plugin to be fully initialized
|
||||
// and also wait for wiki BrowserView to be able to receive command
|
||||
// eslint-disable-next-line global-require
|
||||
|
|
@ -76,7 +77,7 @@ export class WorkspaceView implements IWorkspaceViewService {
|
|||
}
|
||||
loadFailed = typeof workspaceMetadata.didFailLoadErrorMessage === 'string' && workspaceMetadata.didFailLoadErrorMessage.length > 0;
|
||||
if (loadFailed) {
|
||||
throw new Error(workspaceMetadata.didFailLoadErrorMessage!);
|
||||
throw new WorkspaceFailedToLoadError(workspaceMetadata.didFailLoadErrorMessage!, homeUrl);
|
||||
}
|
||||
// get sync process ready
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue