From 4fb3639f715319b300a3329481ffe0be724cf057 Mon Sep 17 00:00:00 2001 From: Bandhan Majumder <133476557+bandhan-majumder@users.noreply.github.com> Date: Sun, 31 Aug 2025 13:42:44 +0530 Subject: [PATCH] refactor: error message for notification subscription failure (#23304) * improve: error message for notification subscription failure * suggestions * Update WebPushContext.tsx --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- packages/features/notifications/WebPushContext.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/features/notifications/WebPushContext.tsx b/packages/features/notifications/WebPushContext.tsx index f271504290..292ef2ad28 100644 --- a/packages/features/notifications/WebPushContext.tsx +++ b/packages/features/notifications/WebPushContext.tsx @@ -71,7 +71,15 @@ export function WebPushProvider({ children }: ProviderProps) { } } catch (error) { console.error("Failed to subscribe:", error); - showToast("Failed to enable notifications", "error"); + if ( + error instanceof DOMException && + error.name === "InvalidAccessError" && + error.message.includes("applicationServerKey") + ) { + showToast("Please enable Google services for push messaging and try again", "error"); + } else { + showToast("Failed to enable notifications", "error"); + } } finally { setIsLoading(false); }