From 8d9daed8491ba1c432123da964f13a410c758c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Fr=C3=B6lich?= Date: Mon, 10 Jul 2023 14:06:58 +0200 Subject: [PATCH] fix: unhandled error cases in interval calls --- src-tauri/Cargo.lock | 2 +- src/beibootctl.ts | 19 +++++++++++++------ src/components/ClusterTable.vue | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 946a8df..e19331a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -152,7 +152,7 @@ checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "beiboot_desktop" -version = "0.1.0-rc.0" +version = "0.1.0" dependencies = [ "bollard", "futures", diff --git a/src/beibootctl.ts b/src/beibootctl.ts index 06040e6..efa1075 100644 --- a/src/beibootctl.ts +++ b/src/beibootctl.ts @@ -54,15 +54,22 @@ export async function startOAuthServer() { export async function checkRunningConnects() { const appStore = useAppStore(); - let res: string[] = await invoke("check_running_connects", {}) - if (res.length > 0) { - appStore.connection.clusterName = res[0] - appStore.connection.connected = true; - } else { + try { + let res: string[] = await invoke("check_running_connects", {}) + if (res.length > 0) { + appStore.connection.clusterName = res[0] + appStore.connection.connected = true; + } else { + appStore.connection.clusterName = "" + appStore.connection.connected = false; + } + return res + } catch { appStore.connection.clusterName = "" appStore.connection.connected = false; + console.log("no docker client here.") + return "Docker Client unresponsive." } - return res } export async function checkDockerEngine() { let res: string = await invoke("check_docker_engine", {}) diff --git a/src/components/ClusterTable.vue b/src/components/ClusterTable.vue index 88a0ba2..b471884 100644 --- a/src/components/ClusterTable.vue +++ b/src/components/ClusterTable.vue @@ -108,7 +108,7 @@ const getChipColor = (state: string) => { const getClusterList = () => { ClustersService.clusterListClustersGet().then((res) => { clusterList.value = res.items; - }); + }).catch((err) => console.log("Error fetching cluster list.")); }; const clusterConnect = (clusterId: string, clusterName: string) => {