Catch HTTP Errors in case pod metrics resources do not exist or access is forbidden (#1755)

Signed-off-by: Mario Sarcher <msarcher@mirantis.com>

Add proper error message when catching a error during loadKubeMetrics()

Co-authored-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Mario Sarcher <msarcher@mirantis.com>

Co-authored-by: Mario Sarcher <msarcher@mirantis.com>
Co-authored-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
authored and GitHub committed 2020-12-28 11:06:16 +02:00
1 parent 21e6616cc0
commit 00c2c2c3c9
1 file changed
+6 -3
@@ -23,9 +23,12 @@ export class PodsStore extends KubeObjectStore<Pod> {
}
async loadKubeMetrics(namespace?: string) {
const metrics = await podMetricsApi.list({ namespace });
this.kubeMetrics.replace(metrics);
try {
const metrics = await podMetricsApi.list({ namespace });
this.kubeMetrics.replace(metrics);
} catch (error) {
console.error("loadKubeMetrics failed", error);
}
}
getPodsByOwner(workload: WorkloadKubeObject): Pod[] {