From 501f6df473ff5c7d730be8ce4be315f2dbf9ae9b Mon Sep 17 00:00:00 2001 From: SteveLauC Date: Sun, 14 Dec 2025 09:24:13 +0800 Subject: [PATCH] chore: show error msg (not err code) when installing exts via deeplink/store fails (#1007) * chore: show error msg (not err code) when installing exts via deeplink fails When installing extensions via deeplink fails, previous implementation showed the raw error code returned from the backend interfaces, which is not user-friendly. We now call installExtensionError() to interrupt the error code to get a human-readable error message, then show it to the users. * fix: correct install extension error when installing via store --- docs/content.en/docs/release-notes/_index.md | 2 ++ src/components/Search/ExtensionStore.tsx | 2 +- src/hooks/useDeepLinkManager.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/content.en/docs/release-notes/_index.md b/docs/content.en/docs/release-notes/_index.md index 0709ad9d..e7721105 100644 --- a/docs/content.en/docs/release-notes/_index.md +++ b/docs/content.en/docs/release-notes/_index.md @@ -19,6 +19,8 @@ Information about release notes of Coco App is provided here. ### ✈️ Improvements +- chore: show error msg (not err code) when installing exts via deeplink fails #1007 + ## 0.9.1 (2025-12-05) ### ❌ Breaking changes diff --git a/src/components/Search/ExtensionStore.tsx b/src/components/Search/ExtensionStore.tsx index ce0124f8..4ab2d104 100644 --- a/src/components/Search/ExtensionStore.tsx +++ b/src/components/Search/ExtensionStore.tsx @@ -244,7 +244,7 @@ const ExtensionStore = ({ extensionId }: { extensionId?: string }) => { "info" ); } catch (error) { - installExtensionError(String(error)); + installExtensionError(error); } finally { const { installingExtensions } = useSearchStore.getState(); diff --git a/src/hooks/useDeepLinkManager.ts b/src/hooks/useDeepLinkManager.ts index 4c02ca47..a65389a1 100644 --- a/src/hooks/useDeepLinkManager.ts +++ b/src/hooks/useDeepLinkManager.ts @@ -12,6 +12,7 @@ import platformAdapter from "@/utils/platformAdapter"; import { useTranslation } from "react-i18next"; import { MAIN_WINDOW_LABEL, SETTINGS_WINDOW_LABEL } from "@/constants"; import { useAsyncEffect, useEventListener } from "ahooks"; +import { installExtensionError } from "@/utils"; export interface DeepLinkHandler { pattern: string; @@ -78,7 +79,7 @@ export function useDeepLinkManager() { addError(t("deepLink.extensionInstallSuccessfully"), "info"); console.log("Extension installed successfully:", extensionId); } catch (error) { - addError(String(error)); + installExtensionError(error) } }, []);