From 25a8b089f83ead39305353d586bdb5bc1819b758 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 9 Nov 2022 10:51:46 -0500 Subject: [PATCH] Fix error shown to users when load fails Signed-off-by: Sebastian Malton --- src/common/k8s-api/kube-object.store.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/common/k8s-api/kube-object.store.ts b/src/common/k8s-api/kube-object.store.ts index 0856176a59..32a762a74c 100644 --- a/src/common/k8s-api/kube-object.store.ts +++ b/src/common/k8s-api/kube-object.store.ts @@ -7,7 +7,7 @@ import type { ClusterContext } from "./cluster-context"; import { action, computed, makeObservable, observable, reaction, when } from "mobx"; import type { Disposer } from "../utils"; -import { waitUntilDefined, autoBind, includes, isRequestError, noop, rejectPromiseBy } from "../utils"; +import { waitUntilDefined, autoBind, includes, noop, rejectPromiseBy } from "../utils"; import type { KubeJsonApiDataFor, KubeObject } from "./kube-object"; import { KubeStatus } from "./kube-object"; import type { IKubeWatchEvent } from "./kube-watch-event"; @@ -221,11 +221,7 @@ export abstract class KubeObjectStore< try { return await res ?? []; } catch (error) { - onLoadFailure(( - isRequestError(error) - ? error.message || error.toString() - : "Unknown error" - )); + onLoadFailure(String(error)); // reset the store because we are loading all, so that nothing is displayed this.items.clear();