ATL-1137: Show error when could not connect to CLI

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2021-03-24 16:03:21 +01:00
committed by Akos Kitta
parent a3f7b795a0
commit 26a1db3cf8
6 changed files with 39 additions and 41 deletions

View File

@@ -6,6 +6,7 @@ import { MessageService } from '@theia/core/lib/common/message-service';
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
import { FrontendApplication } from '@theia/core/lib/browser/frontend-application';
import { FocusTracker, Widget } from '@theia/core/lib/browser';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { WorkspaceService as TheiaWorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
import { ConfigService } from '../../../common/protocol/config-service';
import { SketchesService, Sketch, SketchContainer } from '../../../common/protocol/sketches-service';
@@ -29,10 +30,15 @@ export class WorkspaceService extends TheiaWorkspaceService {
@inject(ApplicationServer)
protected readonly applicationServer: ApplicationServer;
@inject(FrontendApplicationStateService)
protected readonly appStateService: FrontendApplicationStateService;
private application: FrontendApplication;
private workspaceUri?: Promise<string | undefined>;
private version?: string
private version?: string;
async onStart(application: FrontendApplication): Promise<void> {
this.application = application;
const info = await this.applicationServer.getApplicationInfo();
this.version = info?.version;
application.shell.onDidChangeCurrentWidget(this.onCurrentWidgetChange.bind(this));
@@ -62,11 +68,12 @@ export class WorkspaceService extends TheiaWorkspaceService {
}
return (await this.sketchService.createNewSketch()).uri;
} catch (err) {
this.appStateService.reachedState('ready').then(() => this.application.shell.update());
this.logger.fatal(`Failed to determine the sketch directory: ${err}`)
this.messageService.error(
'There was an error creating the sketch directory. ' +
'See the log for more details. ' +
'The application will probably not work as expected.')
'The application will probably not work as expected.');
return super.getDefaultWorkspaceUri();
}
})();