fix/ui-1.0.0:api fetch error need to throw

This commit is contained in:
lethe committed 2025-07-31 18:06:01 +08:00
1 parent 31e3b6b0a8
commit 49627d2449
1 file changed
+6 -7
+6 -7
View File
@@ -54,12 +54,11 @@ export const fetchAPI = async <T = any>(
};
}
} 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;
}
};