fix(push): include underlying error text in subscribe failure toast
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 <noreply@anthropic.com>
This commit is contained in:
parent
c4e0f2f89f
commit
31bc9f3c7b
@ -198,10 +198,13 @@ export function usePushNotifications() {
|
|||||||
return ok;
|
return ok;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Push subscribe failed:", 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({
|
toast({
|
||||||
title: "فعالسازی اعلان با خطا مواجه شد",
|
title: "فعالسازی اعلان با خطا مواجه شد",
|
||||||
description: "لطفاً چند لحظه بعد دوباره تلاش کنید.",
|
description: `${detail || "خطای ناشناخته"}. لطفاً چند لحظه بعد دوباره تلاش کنید.`,
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user