From 31bc9f3c7b86aa654f561c2cd3eb952edb0a4ebe Mon Sep 17 00:00:00 2001 From: fazli Date: Sun, 19 Jul 2026 16:22:50 +0000 Subject: [PATCH] fix(push): include underlying error text in subscribe failure toast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sellers running from an installed PWA still hit failures inside subscribe (iOS 16.4+ PWA has its own quirks even when standalone), and a generic "لطفاً چند لحظه بعد دوباره تلاش کنید" doesn't tell whoever is helping them what actually broke. The catch handler now surfaces the underlying Error.message (e.g. "timeout: pushManager.subscribe", "NotAllowedError") in the toast description so field debugging works over screenshots. Co-Authored-By: Claude --- app/hooks/usePushNotifications.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/hooks/usePushNotifications.ts b/app/hooks/usePushNotifications.ts index e3193c6..f95f367 100644 --- a/app/hooks/usePushNotifications.ts +++ b/app/hooks/usePushNotifications.ts @@ -198,10 +198,13 @@ export function usePushNotifications() { return ok; } catch (e) { console.error("Push subscribe failed:", e); - // Anything unexpected — surface it so the seller knows to retry. + // Include the step name / error text in the toast so field debugging + // doesn't need browser console access — sellers can read out what + // failed to whoever's helping them. + const detail = e instanceof Error ? e.message : String(e); toast({ title: "فعال‌سازی اعلان با خطا مواجه شد", - description: "لطفاً چند لحظه بعد دوباره تلاش کنید.", + description: `${detail || "خطای ناشناخته"}. لطفاً چند لحظه بعد دوباره تلاش کنید.`, variant: "destructive", }); return false;