1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add guards to prevent activation errors slipping through

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-07-18 16:22:57 -04:00
parent 70105a6ef2
commit 3d3b3ffb7f

View File

@ -340,15 +340,35 @@ export class Cluster implements ClusterModel, ClusterState {
} }
if (this.disconnected || !this.accessible) { if (this.disconnected || !this.accessible) {
try {
this.broadcastConnectUpdate("Starting connection ...");
await this.reconnect(); await this.reconnect();
} catch (error) {
this.broadcastConnectUpdate(`Failed to start connection: ${error}`, true);
return;
}
} }
try {
this.broadcastConnectUpdate("Refreshing connection status ..."); this.broadcastConnectUpdate("Refreshing connection status ...");
await this.refreshConnectionStatus(); await this.refreshConnectionStatus();
} catch (error) {
this.broadcastConnectUpdate(`Failed to connection status: ${error}`, true);
return;
}
if (this.accessible) { if (this.accessible) {
try {
this.broadcastConnectUpdate("Refreshing cluster accessibility ..."); this.broadcastConnectUpdate("Refreshing cluster accessibility ...");
await this.refreshAccessibility(); await this.refreshAccessibility();
} catch (error) {
this.broadcastConnectUpdate(`Failed to refresh accessibility: ${error}`, true);
return;
}
// download kubectl in background, so it's not blocking dashboard // download kubectl in background, so it's not blocking dashboard
this.ensureKubectl() this.ensureKubectl()
.catch(error => this.dependencies.logger.warn(`[CLUSTER]: failed to download kubectl for clusterId=${this.id}`, error)); .catch(error => this.dependencies.logger.warn(`[CLUSTER]: failed to download kubectl for clusterId=${this.id}`, error));