mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add defensive code around Cluster.broadcastConnectUpdate (#5297)
This commit is contained in:
1 parent
19c77eefaf
commit
d92233d58e
3 files changed
+25
-5
No files matched your search
@@ -504,7 +504,9 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
return ClusterStatus.AccessDenied;
|
||||
}
|
||||
|
||||
this.broadcastConnectUpdate(error.error || error.message, true);
|
||||
const message = String(error.error || error.message) || String(error);
|
||||
|
||||
this.broadcastConnectUpdate(message, true);
|
||||
|
||||
return ClusterStatus.Offline;
|
||||
}
|
||||
@@ -521,7 +523,9 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
return ClusterStatus.AccessDenied;
|
||||
}
|
||||
|
||||
this.broadcastConnectUpdate(error.message, true);
|
||||
const message = String(error.error || error.message) || String(error);
|
||||
|
||||
this.broadcastConnectUpdate(message, true);
|
||||
|
||||
return ClusterStatus.Offline;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,14 @@ export function isString(val: unknown): val is string {
|
||||
return typeof val === "string";
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if val is of type boolean
|
||||
* @param val the value to be checked
|
||||
*/
|
||||
export function isBoolean(val: unknown): val is boolean {
|
||||
return typeof val === "boolean";
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if val is of type object and isn't null
|
||||
* @param val the value to be checked
|
||||
|
||||
Reference in new issue
Block a user