From 49627d2449988f861ce1f2f9d3419c466dbb57b3 Mon Sep 17 00:00:00 2001 From: lethe Date: Thu, 31 Jul 2025 18:05:40 +0800 Subject: [PATCH] fix/ui-1.0.0:api fetch error need to throw --- frontend/src/shared/rpc/common-function.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/src/shared/rpc/common-function.ts b/frontend/src/shared/rpc/common-function.ts index 79339dc..9245f1a 100644 --- a/frontend/src/shared/rpc/common-function.ts +++ b/frontend/src/shared/rpc/common-function.ts @@ -54,12 +54,11 @@ export const fetchAPI = async ( }; } } catch (error) { - console.error("API fetch error:", error); - return { - success: false, - code: "ERROR", - error_message: error instanceof Error ? error.message : "Unknown error", - data: null as T, - }; + if (error instanceof Error && error.name === "AbortError") { + console.log("Request aborted:", url); + } else { + console.error("Fetch error:", error); + } + throw error; } };