mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-18 07:38:33 +00:00
ATL-1137: Show error when could not connect to CLI
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
})();
|
||||
|
Reference in New Issue
Block a user