Skip to content

Commit f71a266

Browse files
authored
Merge pull request #112 from bcmi-labs/GH-240
GH-240: Warn if not connected to the Internet
2 parents 4732a1d + d8a742e commit f71a266

File tree

4 files changed

+1060
-743
lines changed

4 files changed

+1060
-743
lines changed

arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
157157

158158
@postConstruct()
159159
protected async init(): Promise<void> {
160+
if (!window.navigator.onLine) {
161+
// tslint:disable-next-line:max-line-length
162+
this.messageService.warn('You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.');
163+
}
160164
const updateStatusBar = (config: BoardsConfig.Config) => {
161165
this.statusBar.setElement('arduino-selected-board', {
162166
alignment: StatusBarAlignment.RIGHT,

arduino-ide-extension/src/node/core-client-provider.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ export class CoreClientProvider extends GrpcClientProvider<CoreClientProvider.Cl
3838
const client = new ArduinoCoreClient(`localhost:${port}`, grpc.credentials.createInsecure(), this.channelOptions);
3939
const initReq = new InitReq();
4040
initReq.setLibraryManagerOnly(false);
41-
const initResp = await new Promise<InitResp>(resolve => {
41+
const initResp = await new Promise<InitResp>((resolve, reject) => {
4242
let resp: InitResp | undefined = undefined;
4343
const stream = client.init(initReq);
4444
stream.on('data', (data: InitResp) => resp = data);
4545
stream.on('end', () => resolve(resp));
46-
stream.on('error', err => {
47-
console.log('init error', err)
48-
});
46+
stream.on('error', err => reject(err));
4947
});
5048

5149
const instance = initResp.getInstance();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"private": true,
99
"devDependencies": {
1010
"@theia/cli": "next",
11-
"lerna": "^3.13.3",
11+
"lerna": "^3.20.2",
1212
"rimraf": "^2.6.1",
1313
"tslint": "^5.5.0",
1414
"typescript": "3.5.1"

0 commit comments

Comments
 (0)