From 3d3b3ffb7f698986fa8d3689d680eaacd24c53b9 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 18 Jul 2022 16:22:57 -0400 Subject: [PATCH] Add guards to prevent activation errors slipping through Signed-off-by: Sebastian Malton --- src/common/cluster/cluster.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/common/cluster/cluster.ts b/src/common/cluster/cluster.ts index f3723e140b..11b67bd002 100644 --- a/src/common/cluster/cluster.ts +++ b/src/common/cluster/cluster.ts @@ -340,15 +340,35 @@ export class Cluster implements ClusterModel, ClusterState { } if (this.disconnected || !this.accessible) { - await this.reconnect(); + try { + this.broadcastConnectUpdate("Starting connection ..."); + await this.reconnect(); + } catch (error) { + this.broadcastConnectUpdate(`Failed to start connection: ${error}`, true); + + return; + } } - this.broadcastConnectUpdate("Refreshing connection status ..."); - await this.refreshConnectionStatus(); + try { + this.broadcastConnectUpdate("Refreshing connection status ..."); + await this.refreshConnectionStatus(); + } catch (error) { + this.broadcastConnectUpdate(`Failed to connection status: ${error}`, true); + + return; + } if (this.accessible) { - this.broadcastConnectUpdate("Refreshing cluster accessibility ..."); - await this.refreshAccessibility(); + try { + this.broadcastConnectUpdate("Refreshing cluster accessibility ..."); + await this.refreshAccessibility(); + } catch (error) { + this.broadcastConnectUpdate(`Failed to refresh accessibility: ${error}`, true); + + return; + } + // download kubectl in background, so it's not blocking dashboard this.ensureKubectl() .catch(error => this.dependencies.logger.warn(`[CLUSTER]: failed to download kubectl for clusterId=${this.id}`, error));