Skip to content

Commit f9fa240

Browse files
committed
Catch all installation errors
1 parent a17f432 commit f9fa240

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/installer/stages/platformio-core.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ export default class PlatformIOCoreStage extends BaseStage {
155155
if (code === 0) {
156156
return resolve(stdout);
157157
} else {
158-
const err = new Error(`Conda Virtualenv: ${stderr}`);
159-
misc.reportError(err);
160-
return reject(err);
158+
return reject(new Error(`Conda Virtualenv: ${stderr}`));
161159
}
162160
}
163161
);
@@ -269,16 +267,15 @@ export default class PlatformIOCoreStage extends BaseStage {
269267
console.warn(err);
270268
try {
271269
await this.createVirtualenvWithDownload();
272-
} catch (err) {
273-
misc.reportError(err);
274-
console.warn(err);
270+
} catch (errDl) {
271+
console.warn(errDl);
275272
try {
276273
await this.installVirtualenvPackage();
277274
await this.createVirtualenvWithLocal();
278-
} catch (err) {
279-
misc.reportError(err);
280-
console.warn(err);
281-
throw new Error(`Could not create PIO Core Virtual Environment. Please create it manually -> http://bit.ly/pio-core-virtualenv \n ${err.toString()}`);
275+
} catch (errPkg) {
276+
misc.reportError(errDl);
277+
console.warn(errPkg);
278+
throw new Error(`Could not create PIO Core Virtual Environment. Please create it manually -> http://bit.ly/pio-core-virtualenv \n ${errDl.toString()}`);
282279
}
283280
}
284281
}
@@ -321,7 +318,7 @@ export default class PlatformIOCoreStage extends BaseStage {
321318
if (misc.IS_WINDOWS) {
322319
stderr = `If you have antivirus/firewall/defender software in a system, try to disable it for a while. \n ${stderr}`;
323320
}
324-
reject(new Error(`PIP: ${stderr}`));
321+
return reject(new Error(`PIP Core: ${stderr}`));
325322
}
326323
});
327324
});
@@ -416,9 +413,14 @@ export default class PlatformIOCoreStage extends BaseStage {
416413
}
417414
this.status = BaseStage.STATUS_INSTALLING;
418415

419-
await this.createVirtualenv();
420-
await this.installPIOCore();
421-
await this.installPIOHome();
416+
try {
417+
await this.createVirtualenv();
418+
await this.installPIOCore();
419+
await this.installPIOHome();
420+
} catch (err) {
421+
misc.reportError(err);
422+
throw err;
423+
}
422424

423425
this.status = BaseStage.STATUS_SUCCESSED;
424426
return true;

0 commit comments

Comments
 (0)