From 62010358912f7b0b40f9e02d265ff2f13754f63f Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Sat, 22 Jun 2024 19:04:18 -0300 Subject: [PATCH] update getHealth function to work with stop button --- src/frontend/src/controllers/API/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index 8a4bff599..70887b856 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -325,7 +325,15 @@ export async function getVersion() { * @returns {Promise>} A promise that resolves to an AxiosResponse containing the health status. */ export async function getHealth() { - return await api.get("/health"); // Health is the only endpoint that doesn't require /api/v1 + return await api.get("/health").catch(e=>{ + if(e.code==="ECONNABORTED"){ + console.log("request cancelled"); + } + else{ + // raise error to be caught by the caller + throw e; + } + }); // Health is the only endpoint that doesn't require /api/v1 } /**