Skip to content

Commit b7f781c

Browse files
committed
feat: report bootstrapping errors to UI
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
1 parent afd0e66 commit b7f781c

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/account.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-FileCopyrightText: Copyright 2025 Siemens
44
*/
55

6-
import { ssoLog, load_icon, ssoLogError } from "./utils.js";
6+
import { ssoLog, load_icon } from "./utils.js";
77

88
/* refresh the token if only x time is left */
99
const TOKEN_MIN_VALIDITY_MS = 60 * 1000;
@@ -176,12 +176,7 @@ export class AccountManager {
176176
if (this.hasBrokerData()) return;
177177

178178
ssoLog("loading accounts");
179-
let _accounts = [];
180-
try {
181-
_accounts = await broker.getAccounts();
182-
} catch (error) {
183-
ssoLog(error);
184-
}
179+
const _accounts = await broker.getAccounts();
185180
if (!_accounts || !_accounts.length) {
186181
this.#registered = [];
187182
return;

src/background.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function notify_state_change(ui_only = false) {
145145
broker_version: PLATFORM.host_versions.broker,
146146
sso_url: PLATFORM.getSsoUrl(),
147147
gpo_update: gpo_update,
148+
status: last_status,
148149
});
149150
}
150151

@@ -177,11 +178,17 @@ async function bootstrap_from_broker() {
177178
// wait for the first broker state event before talking to the broker.
178179
await broker_state_received.promise;
179180
if (accountManager.hasBrokerData()) return;
180-
await accountManager.loadAccounts(broker);
181-
accountManager.persist();
182-
await deviceManager.loadDeviceInfo(broker);
183-
deviceManager.persist();
184-
await PLATFORM.setup(broker);
181+
report_status("Loading data from broker\u2026", "info");
182+
try {
183+
await accountManager.loadAccounts(broker);
184+
accountManager.persist();
185+
await deviceManager.loadDeviceInfo(broker);
186+
deviceManager.persist();
187+
await PLATFORM.setup(broker);
188+
report_status(null);
189+
} catch (error) {
190+
report_status("Failed to load data from broker: " + error, "error");
191+
}
185192
notify_state_change();
186193
}
187194

0 commit comments

Comments
 (0)