mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-24 06:40:21 +08:00
fix: surface backend error details in proxy toast messages
The takeover.failed i18n template lacked the {{detail}} placeholder
and three useProxyStatus onError callbacks omitted the detail variable,
so proxy start/stop/takeover failures all displayed a generic message
regardless of the underlying cause.
This commit is contained in:
@@ -205,7 +205,9 @@ export const SubscriptionQuotaView: React.FC<SubscriptionQuotaViewProps> = ({
|
||||
}
|
||||
|
||||
// 成功获取数据
|
||||
const tiers = (quota.tiers || []).filter((tier) => tier.name in TIER_I18N_KEYS);
|
||||
const tiers = (quota.tiers || []).filter(
|
||||
(tier) => tier.name in TIER_I18N_KEYS,
|
||||
);
|
||||
if (tiers.length === 0) return null;
|
||||
|
||||
// ── inline 模式:紧凑两行显示 ──
|
||||
|
||||
@@ -57,6 +57,7 @@ export function useProxyStatus() {
|
||||
t("common.unknown", { defaultValue: "未知错误" });
|
||||
toast.error(
|
||||
t("proxy.server.startFailed", {
|
||||
detail,
|
||||
defaultValue: `启动代理服务失败: ${detail}`,
|
||||
}),
|
||||
);
|
||||
@@ -87,6 +88,7 @@ export function useProxyStatus() {
|
||||
t("common.unknown", { defaultValue: "未知错误" });
|
||||
toast.error(
|
||||
t("proxy.stopWithRestoreFailed", {
|
||||
detail,
|
||||
defaultValue: `停止失败: ${detail}`,
|
||||
}),
|
||||
);
|
||||
@@ -129,6 +131,7 @@ export function useProxyStatus() {
|
||||
t("common.unknown", { defaultValue: "未知错误" });
|
||||
toast.error(
|
||||
t("proxy.takeover.failed", {
|
||||
detail,
|
||||
defaultValue: `操作失败: ${detail}`,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -2056,7 +2056,7 @@
|
||||
"hint": "Select apps to route — once enabled, requests from that app will go through local routing",
|
||||
"enabled": "{{app}} routing enabled",
|
||||
"disabled": "{{app}} routing disabled",
|
||||
"failed": "Failed to toggle routing",
|
||||
"failed": "Failed to toggle routing: {{detail}}",
|
||||
"tooltip": {
|
||||
"active": "{{appLabel}} is routing - {{address}}:{{port}}\nSwitch provider for hot switching",
|
||||
"broken": "{{appLabel}} is routing, but routing service is not running",
|
||||
|
||||
@@ -2056,7 +2056,7 @@
|
||||
"hint": "ルーティングするアプリを選択します。有効にすると、そのアプリのリクエストはローカルルーティング経由で転送されます",
|
||||
"enabled": "{{app}} ルーティング有効",
|
||||
"disabled": "{{app}} ルーティング無効",
|
||||
"failed": "ルーティングの切り替えに失敗しました",
|
||||
"failed": "ルーティングの切り替えに失敗しました: {{detail}}",
|
||||
"tooltip": {
|
||||
"active": "{{appLabel}} がルーティング中 - {{address}}:{{port}}\nホットスイッチングのためプロバイダを切り替え",
|
||||
"broken": "{{appLabel}} がルーティング中ですが、ルーティングサービスが実行されていません",
|
||||
|
||||
@@ -2057,7 +2057,7 @@
|
||||
"hint": "选择要路由的应用,启用后该应用的请求将通过本地路由转发",
|
||||
"enabled": "{{app}} 路由已启用",
|
||||
"disabled": "{{app}} 路由已关闭",
|
||||
"failed": "切换路由状态失败",
|
||||
"failed": "切换路由状态失败: {{detail}}",
|
||||
"tooltip": {
|
||||
"active": "{{appLabel}} 路由中 - {{address}}:{{port}}\n切换该应用供应商为热切换",
|
||||
"broken": "{{appLabel}} 路由中,但路由服务未运行",
|
||||
|
||||
Reference in New Issue
Block a user