From 4f3899cdb9ee11c4023df094b4ff0741852ceea7 Mon Sep 17 00:00:00 2001 From: Dalton Durst Date: Mon, 12 Apr 2021 17:29:18 -0500 Subject: [PATCH] Catch and log early init errors Prior to this change, it was possible for errors initializing or waiting on plugins to go undetected. Errors in wait() would bubble up to the "no-network" error, which has been even more confusing for users. Related, but does not fix: https://github.com/ubports/ubports-installer/issues/1847 --- src/core/core.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/core.js b/src/core/core.js index 20d589b5..92640eb6 100644 --- a/src/core/core.js +++ b/src/core/core.js @@ -66,13 +66,17 @@ class Core { * @returns {Promise} */ prepare(file) { - return Promise.all([this.readConfigFile(file), this.plugins.init()]).then( + return Promise.all([ + this.readConfigFile(file), + this.plugins.init().catch(e => errors.toUser(e, "initializing plugins")), + ]).then( () => { if (this.props.config) { this.selectOs(); } else { const wait = this.plugins .wait() + .catch( e => errors.toUser(e, "plugin wait()")) .then(device => api.resolveAlias(device)) .catch( e =>